Skip to content

Commit 82aab22

Browse files
committed
docs(vitePreprocess): more details around new script default
1 parent b1fc08c commit 82aab22

File tree

1 file changed

+22
-9
lines changed

1 file changed

+22
-9
lines changed

docs/preprocess.md

Lines changed: 22 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -20,16 +20,29 @@ However, `svelte-preprocess` does provide extra functionalities not available wi
2020
- SugarSS: `<style lang="sss">`
2121

2222
By default, PostCSS or LightningCSS ([if configured in Vite](https://vitejs.dev/config/shared-options.html#css-transformer)) is applied to all `<style>` tags.
23+
If required, you can style transforming off by setting the `style` option to `false`. The `style` option also accepts Vite's `InlineConfig` and `ResolvedConfig` types for advanced usage.
2324

24-
If required, you can turn script or style transforming off by setting the `script` or `style` option to `false`. The `style` option also accepts Vite's `InlineConfig` and `ResolvedConfig` types for advanced usage.
25+
> TypeScript is no longer preprocessed by default as Svelte 5 understands most syntax natively.
26+
> If you use TypeScript features that emit code like enum, using , decorators or class declarations with visibility modifiers, you have to enable the script preprocessor manually.
2527
26-
**Example:**
28+
### Examples
2729

28-
```js
29-
// svelte.config.js
30-
import { vitePreprocess } from '@sveltejs/vite-plugin-svelte';
30+
#### default
3131

32-
export default {
33-
preprocess: [vitePreprocess()]
34-
};
35-
```
32+
```js
33+
// svelte.config.js
34+
import { vitePreprocess } from '@sveltejs/vite-plugin-svelte';
35+
export default {
36+
preprocess: [vitePreprocess()]
37+
};
38+
```
39+
40+
#### enable script preprocessing for advanced TypeScript syntax use
41+
42+
```js
43+
// svelte.config.js
44+
import { vitePreprocess } from '@sveltejs/vite-plugin-svelte';
45+
export default {
46+
preprocess: [vitePreprocess({ script: true })]
47+
};
48+
```

0 commit comments

Comments
 (0)