You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardexpand all lines: docs/config/index.md
+4-2
Original file line number
Diff line number
Diff line change
@@ -22,8 +22,10 @@ You can also explicitly specify a config file to use with the `--config` CLI opt
22
22
vite --config my-config.js
23
23
```
24
24
25
-
::: tip BUNDLING THE CONFIG
26
-
By default, Vite uses `esbuild` to bundle the config into a temporary file. This can cause issues when importing TypeScript files in a monorepo. If you encounter any issues with this approach, you can specify `--configLoader=runner` to use the module runner instead - it will not create a temporary config and will transform any files on the fly. Note that module runner doesn't support CJS in config files, but external CJS packages should work as usual.
25
+
::: tip CONFIG LOADING
26
+
By default, Vite uses `esbuild` to bundle the config into a temporary file and load it. This may cause issues when importing TypeScript files in a monorepo. If you encounter any issues with this approach, you can specify `--configLoader runner` to use the [module runner](/guide/api-environment-runtimes.html#modulerunner) instead, which will not create a temporary config and will transform any files on the fly. Note that module runner doesn't support CJS in config files, but external CJS packages should work as usual.
27
+
28
+
Alternatively, if you're using an environment that supports TypeScript (e.g. `node --experimental-strip-types`), or if you're only writing plain JavaScript, you can specify `--configLoader native` to use the environment's native runtime to load the config file. Note that updates to modules imported by the config file are not detected and hence would not auto-restart the Vite server.
|`--clearScreen`| Allow/disable clear screen when logging (`boolean`) |
29
+
|`--configLoader <loader>`| Use `bundle` to bundle the config with esbuild, or `runner` (experimental) to process it on the fly, or `native` (experimental) to load using the native runtime (default: `bundle`) |
Copy file name to clipboardexpand all lines: packages/vite/src/node/cli.ts
+2-2
Original file line number
Diff line number
Diff line change
@@ -23,7 +23,7 @@ interface GlobalCLIOptions {
23
23
l?: LogLevel
24
24
logLevel?: LogLevel
25
25
clearScreen?: boolean
26
-
configLoader?: 'bundle'|'runner'
26
+
configLoader?: 'bundle'|'runner'|'native'
27
27
d?: boolean|string
28
28
debug?: boolean|string
29
29
f?: string
@@ -155,7 +155,7 @@ cli
155
155
.option('--clearScreen',`[boolean] allow/disable clear screen when logging`)
156
156
.option(
157
157
'--configLoader <loader>',
158
-
`[string] use 'bundle' to bundle the config with esbuild or 'runner' (experimental) to process it on the fly (default: bundle)`,
158
+
`[string] use 'bundle' to bundle the config with esbuild, or 'runner' (experimental) to process it on the fly, or 'native' (experimental) to load using the native runtime (default: bundle)`,
159
159
)
160
160
.option('-d, --debug [feat]',`[string | boolean] show debug logs`)
0 commit comments