@@ -15,14 +15,13 @@ const knownOptions = new Set([
15
15
'preprocess' ,
16
16
'hot' ,
17
17
'disableCssHmr' ,
18
- 'useVitePreprocess ' ,
19
- 'ignorePluginPreprocessors '
18
+ 'ignorePluginPreprocessors ' ,
19
+ 'experimental '
20
20
] ) ;
21
21
22
22
function buildDefaultOptions ( isProduction : boolean , options : Partial < Options > ) : Partial < Options > {
23
- const disableCssHmr = ! ! options ?. disableCssHmr ;
24
23
// emit for prod, emit in dev unless css hmr is disabled
25
- const emitCss = options ?. emitCss != null ? options . emitCss : isProduction || ! disableCssHmr ;
24
+ const emitCss = options ?. emitCss != null ? options . emitCss : true ;
26
25
// no hmr in prod, only inject css in dev if emitCss is false
27
26
const hot = isProduction
28
27
? false
@@ -40,12 +39,7 @@ function buildDefaultOptions(isProduction: boolean, options: Partial<Options>):
40
39
hydratable : true
41
40
}
42
41
} ;
43
- log . debug (
44
- `default options for ${ isProduction ? 'production' : 'development' } ${
45
- ! isProduction && disableCssHmr ? ' with css hmr disabled' : ''
46
- } `,
47
- defaultOptions
48
- ) ;
42
+ log . debug ( `default options for ${ isProduction ? 'production' : 'development' } ` , defaultOptions ) ;
49
43
return defaultOptions ;
50
44
}
51
45
@@ -125,6 +119,10 @@ function mergeOptions(
125
119
...( svelteConfig ?. compilerOptions || { } ) ,
126
120
...( inlineOptions ?. compilerOptions || { } )
127
121
} ,
122
+ experimental : {
123
+ ...( svelteConfig ?. experimental || { } ) ,
124
+ ...( inlineOptions ?. experimental || { } )
125
+ } ,
128
126
root : viteConfig . root || process . cwd ( ) ,
129
127
isProduction : viteEnv . mode === 'production' ,
130
128
isBuild : viteEnv . command === 'build' ,
@@ -195,7 +193,7 @@ export function buildExtraViteConfig(
195
193
}
196
194
}
197
195
198
- if ( options . useVitePreprocess ) {
196
+ if ( options . experimental ?. useVitePreprocess ) {
199
197
// needed to transform svelte files with component imports
200
198
// can cause issues with other typescript files, see https://github.com/sveltejs/vite-plugin-svelte/pull/20
201
199
extraViteConfig . esbuild = {
@@ -390,7 +388,20 @@ export interface Options {
390
388
ignorePluginPreprocessors ?: boolean | string [ ] ;
391
389
392
390
/**
393
- * use vite as extra css preprocessor EXPERIMENTAL!
391
+ * These options are considered experimental and breaking changes to them can occur in any release
392
+ */
393
+ experimental ?: ExperimentalOptions ;
394
+ }
395
+
396
+ /**
397
+ * These options are considered experimental and breaking changes to them can occur in any release
398
+ */
399
+ export interface ExperimentalOptions {
400
+ /**
401
+ * use extra preprocessors that delegate style and typescript preproessing to native vite plugins
402
+ *
403
+ * do not use together with svelte-preprocess!
404
+ *
394
405
* @default false
395
406
*/
396
407
useVitePreprocess ?: boolean ;
0 commit comments