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.md
+27-10Lines changed: 27 additions & 10 deletions
Original file line number
Diff line number
Diff line change
@@ -23,7 +23,8 @@ Besides inline options in Vite config, `vite-plugin-svelte` will also automatica
23
23
24
24
-`svelte.config.js`
25
25
-`svelte.config.mjs`
26
-
-`svelte.config.cjs`
26
+
-`svelte.config.ts`
27
+
-`svelte.config.mts`
27
28
28
29
To set a specific config file, use the `configFile` inline option. The path can be absolute or relative to the [Vite root](https://vitejs.dev/config/#root). For example:
29
30
@@ -43,7 +44,7 @@ A basic Svelte config looks like this:
43
44
```js
44
45
// svelte.config.js
45
46
exportdefault {
46
-
//svelte options
47
+
//Svelte options
47
48
extensions: ['.svelte'],
48
49
compilerOptions: {},
49
50
preprocess: [],
@@ -59,10 +60,10 @@ export default {
59
60
60
61
### Config file extension
61
62
62
-
Depending on Node's mode, make sure you're using the correct extension and syntax so it can be resolved safely.
63
+
The Svelte config should always be written in ESM syntax. Depending on Node's mode, make sure you're using the correct extension.
63
64
64
-
- If `type: "module"` is defined in `package.json`, using`.js`only allows ESM code. Use `.cjs` to allow CJS code.
65
-
- If `type: "module"` is not defined, using`.js` only allows CJS code. Use `.mjs` to allows ESM code.
65
+
- If `type: "module"` is defined in `package.json`, prefer`.js`or `.ts`
66
+
- If `type: "module"` is not defined, use`.mjs` or `.mts`
66
67
67
68
> Try to stick with the `.js` extension whenever possible.
68
69
@@ -76,7 +77,7 @@ export default defineConfig({
76
77
plugins: [
77
78
svelte({
78
79
configFile:false
79
-
// your svelte config here
80
+
// your Svelte config here
80
81
})
81
82
]
82
83
});
@@ -157,12 +158,14 @@ These options are specific to the Vite plugin itself.
157
158
### include
158
159
159
160
-**Type:**`string | string[]`
161
+
-**Default:** unset
160
162
161
-
A [picomatch pattern](https://github.com/micromatch/picomatch), or array of patterns, which specifies the files the plugin should operate on. By default, all svelte files are included.
163
+
A [picomatch pattern](https://github.com/micromatch/picomatch), or array of patterns, which specifies the files the plugin should operate on**in addition** to the files ending with one of the configured extensions.
162
164
163
165
### exclude
164
166
165
167
-**Type:**`string | string[]`
168
+
-**Default:** unset
166
169
167
170
A [picomatch pattern](https://github.com/micromatch/picomatch), or array of patterns, which specifies the files to be ignored by the plugin. By default, no files are ignored.
168
171
@@ -215,7 +218,7 @@ A [picomatch pattern](https://github.com/micromatch/picomatch), or array of patt
215
218
-**Type:**`InspectorOptions | boolean`
216
219
-**Default:**`unset` for dev, always `false` for build
217
220
218
-
Set to `true` or options object to enable svelte inspector during development. See the [inspector docs](./inspector.md) for the full configuration options.
221
+
Set to `true` or options object to enable Svelte inspector during development. See the [inspector docs](./inspector.md) for the full configuration options.
219
222
220
223
Inspector mode shows you the file location where the element under cursor is defined and you can click to quickly open your code editor at this location.
221
224
@@ -308,7 +311,7 @@ export default {
308
311
normalizedFilename: string;
309
312
timestamp: number;
310
313
warnings: Warning[]; // allWarnings filtered by warnings where onwarn did not call the default handler
311
-
allWarnings: Warning[]; // includes warnings filtered by onwarn and our extra vitepluginsvelte warnings
314
+
allWarnings: Warning[]; // includes warnings filtered by onwarn and our extra vite-plugin-svelte warnings
312
315
rawWarnings: Warning[]; // raw compiler output
313
316
};
314
317
```
@@ -318,4 +321,18 @@ export default {
318
321
-**Type**`boolean`
319
322
-**Default:**`false`
320
323
321
-
disable svelte resolve warnings. Note:this is highly discouraged and you should instead fix these packages which will breakin the future.
324
+
disable Svelte resolve warnings. Note:this is highly discouraged and you should instead fix these packages which will breakin the future.
325
+
326
+
### disableApiSveltePreprocessWarnings
327
+
328
+
-**Type**`boolean`
329
+
-**Default:**`false`
330
+
331
+
disable api.sveltePreprocess deprecation warnings
332
+
333
+
### compileModule
334
+
335
+
-**Type**`CompileModuleOptions`
336
+
-**Default:**`undefined`
337
+
338
+
set custom compile options for compilation of Svelte modules (`.svelte.js` files).
0 commit comments