-
Notifications
You must be signed in to change notification settings - Fork 204
Expand file tree
/
Copy pathvite.config.mts
More file actions
96 lines (94 loc) · 3.48 KB
/
Copy pathvite.config.mts
File metadata and controls
96 lines (94 loc) · 3.48 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
/// <reference types="vitest" />
/// <reference types="vite/client" />
import path from 'path'
import react from '@vitejs/plugin-react'
import lostCss from 'lost'
import postcssApply from 'postcss-apply'
import postColorModFunction from 'postcss-color-mod-function'
import postCssImport from 'postcss-import'
import postCssPresetEnv from 'postcss-preset-env'
import { defineConfig } from 'vite'
export default defineConfig({
build: {
// Relative to the root
outDir: 'dist',
},
plugins: [
react({
include: '**/*.tsx',
babel: {
// Use babel.config.js files
configFile: true,
},
}),
],
optimizeDeps: {
esbuildOptions: {
target: 'es2020',
},
exclude: ['node_modules'],
},
css: {
postcss: {
plugins: [
postCssImport({ root: 'src/' }),
postcssApply(),
postColorModFunction(),
postCssPresetEnv({ stage: 0 }),
lostCss(),
],
},
},
define: {
// These defines mimic the ones set in various project-local vite.config.mts files.
// NOTE: For security, only include environment variables here if they're explicitly allowlisted.
_FF_ENV_VARS_: {},
_NODE_ENV_: JSON.stringify(process.env.NODE_ENV),
_OT_AI_CLIENT_MIXPANEL_ID_: JSON.stringify(
process.env.OT_AI_CLIENT_MIXPANEL_ID
),
_OT_APP_MIXPANEL_ID_: JSON.stringify(process.env.OT_APP_MIXPANEL_ID),
_OT_SENTRY_DSN_: JSON.stringify(process.env.OT_SENTRY_DSN),
_OT_LL_MIXPANEL_DEV_ID_: JSON.stringify(process.env.OT_LL_MIXPANEL_DEV_ID),
_OT_LL_MIXPANEL_ID_: JSON.stringify(process.env.OT_LL_MIXPANEL_ID),
_OT_PD_BUILD_DATE_: JSON.stringify(process.env.OT_PD_BUILD_DATE),
_OT_PD_MIXPANEL_DEV_ID_: JSON.stringify(process.env.OT_PD_MIXPANEL_DEV_ID),
_OT_PD_MIXPANEL_ID_: JSON.stringify(process.env.OT_PD_MIXPANEL_ID),
_OT_PD_SENTRY_DEV_DSN_: JSON.stringify(process.env.OT_PD_SENTRY_DEV_DSN),
_OT_PD_SENTRY_DSN_: JSON.stringify(process.env.OT_PD_SENTRY_DSN),
_OT_PD_VERSION_: JSON.stringify(process.env.OT_PD_VERSION),
'process.env.NODE_DEBUG': JSON.stringify(process.env.NODE_DEBUG),
global: 'globalThis',
},
resolve: {
alias: {
// todo(mm, 2025-10-27): These cross-project aliases cause trouble like
// files being processed with the wrong config (the config from the
// consuming project vs. the config from the source project).
// Can these be replaced with regular package.json dependencies?
'@opentrons/components/styles': path.resolve(
'./components/src/index.module.css'
),
'@opentrons/components': path.resolve('./components/src/index.ts'),
'@opentrons/shared-data/pipette/fixtures/name': path.resolve(
'./shared-data/pipette/fixtures/name/index.ts'
),
'@opentrons/shared-data/labware/fixtures/1': path.resolve(
'./shared-data/labware/fixtures/1/index.ts'
),
'@opentrons/shared-data/labware/fixtures/2': path.resolve(
'./shared-data/labware/fixtures/2/index.ts'
),
'@opentrons/shared-data/labware/fixtures/3': path.resolve(
'./shared-data/labware/fixtures/3/index.ts'
),
'@opentrons/shared-data': path.resolve('./shared-data/js/index.ts'),
'@opentrons/step-generation': path.resolve(
'./step-generation/src/index.ts'
),
'/app/': path.resolve('./app/src/') + '/',
'/ai-client/': path.resolve('./opentrons-ai-client/src/') + '/',
'/protocol-designer/': path.resolve('./protocol-designer/src/') + '/',
},
},
})