Skip to content

Commit 0b010e3

Browse files
authored
chore!: remove useVitePreprocess (#538)
1 parent 737b4fa commit 0b010e3

File tree

6 files changed

+8
-39
lines changed

6 files changed

+8
-39
lines changed

.changeset/fast-ligers-sort.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@sveltejs/vite-plugin-svelte': patch
3+
---
4+
5+
Remove `experimental.useVitePreprocess` option in favour of `vitePreprocess`

docs/config.md

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -244,13 +244,6 @@ export default {
244244
};
245245
```
246246

247-
### useVitePreprocess
248-
249-
- **Type:** `boolean`
250-
- **Default:** `false`
251-
252-
Use extra preprocessors that delegate style and TypeScript preprocessing to native Vite plugins. TypeScript will be transformed with esbuild. Styles will be transformed using [Vite's CSS plugin](https://vitejs.dev/guide/features.html#css), which handles `@imports`, `url()` references, PostCSS, CSS Modules, and `.scss`/`.sass`/`.less`/`.styl`/`.stylus` files. Do not use together with TypeScript or style preprocessors from `svelte-preprocess` as attempts to transform the content twice will fail!
253-
254247
### dynamicCompileOptions
255248

256249
- **Type:**

packages/e2e-tests/import-queries/svelte.config.js

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
1+
import { vitePreprocess } from '@sveltejs/vite-plugin-svelte';
2+
13
export default {
2-
vitePlugin: {
3-
experimental: {
4-
useVitePreprocess: true
5-
}
6-
},
4+
preprocess: [vitePreprocess()],
75
onwarn(warning, defaultHandler) {
86
// import query test generates one of these
97
if (warning.code === 'custom-element-no-tag') return;

packages/vite-plugin-svelte/src/index.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,6 @@ export function svelte(inlineOptions?: Partial<Options>): Plugin[] {
8989
if (isSvelteMetadataChanged) {
9090
// Force Vite to optimize again. Although we mutate the config here, it works because
9191
// Vite's optimizer runs after `buildStart()`.
92-
// TODO: verify this works in vite3
9392
viteConfig.optimizeDeps.force = true;
9493
}
9594
},

packages/vite-plugin-svelte/src/utils/options.ts

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -680,15 +680,6 @@ export interface SvelteOptions {
680680
* These options are considered experimental and breaking changes to them can occur in any release
681681
*/
682682
export interface ExperimentalOptions {
683-
/**
684-
* Use extra preprocessors that delegate style and TypeScript preprocessing to native Vite plugins
685-
*
686-
* Do not use together with `svelte-preprocess`!
687-
*
688-
* @default false
689-
*/
690-
useVitePreprocess?: boolean;
691-
692683
/**
693684
* A function to update `compilerOptions` before compilation
694685
*

packages/vite-plugin-svelte/src/utils/preprocess.ts

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,8 @@
11
import type { ResolvedConfig, Plugin } from 'vite';
22
import MagicString from 'magic-string';
3-
import { preprocess } from 'svelte/compiler';
43
import { PreprocessorGroup, ResolvedOptions } from './options';
54
import { log } from './log';
65
import path from 'path';
7-
import { vitePreprocess } from '../preprocess';
8-
9-
function createVitePreprocessorGroup(config: ResolvedConfig): PreprocessorGroup {
10-
return {
11-
markup({ content, filename }) {
12-
return preprocess(content, vitePreprocess({ style: config }), { filename });
13-
}
14-
};
15-
}
166

177
/**
188
* this appends a *{} rule to component styles to force the svelte compiler to add style classes to all nodes
@@ -40,13 +30,6 @@ function buildExtraPreprocessors(options: ResolvedOptions, config: ResolvedConfi
4030
const prependPreprocessors: PreprocessorGroup[] = [];
4131
const appendPreprocessors: PreprocessorGroup[] = [];
4232

43-
if (options.experimental?.useVitePreprocess) {
44-
log.warn(
45-
'`experimental.useVitePreprocess` is deprecated. Use the `vitePreprocess()` preprocessor instead. See https://github.com/sveltejs/vite-plugin-svelte/blob/main/docs/preprocess.md for more information.'
46-
);
47-
prependPreprocessors.push(createVitePreprocessorGroup(config));
48-
}
49-
5033
// @ts-ignore
5134
const pluginsWithPreprocessorsDeprecated = config.plugins.filter((p) => p?.sveltePreprocess);
5235
if (pluginsWithPreprocessorsDeprecated.length > 0) {

0 commit comments

Comments
 (0)