@@ -15,14 +15,13 @@ const knownOptions = new Set([
1515 'preprocess' ,
1616 'hot' ,
1717 'disableCssHmr' ,
18- 'useVitePreprocess ' ,
19- 'ignorePluginPreprocessors '
18+ 'ignorePluginPreprocessors ' ,
19+ 'experimental '
2020] ) ;
2121
2222function buildDefaultOptions ( isProduction : boolean , options : Partial < Options > ) : Partial < Options > {
23- const disableCssHmr = ! ! options ?. disableCssHmr ;
2423 // 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 ;
2625 // no hmr in prod, only inject css in dev if emitCss is false
2726 const hot = isProduction
2827 ? false
@@ -40,12 +39,7 @@ function buildDefaultOptions(isProduction: boolean, options: Partial<Options>):
4039 hydratable : true
4140 }
4241 } ;
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 ) ;
4943 return defaultOptions ;
5044}
5145
@@ -125,6 +119,10 @@ function mergeOptions(
125119 ...( svelteConfig ?. compilerOptions || { } ) ,
126120 ...( inlineOptions ?. compilerOptions || { } )
127121 } ,
122+ experimental : {
123+ ...( svelteConfig ?. experimental || { } ) ,
124+ ...( inlineOptions ?. experimental || { } )
125+ } ,
128126 root : viteConfig . root || process . cwd ( ) ,
129127 isProduction : viteEnv . mode === 'production' ,
130128 isBuild : viteEnv . command === 'build' ,
@@ -195,7 +193,7 @@ export function buildExtraViteConfig(
195193 }
196194 }
197195
198- if ( options . useVitePreprocess ) {
196+ if ( options . experimental ?. useVitePreprocess ) {
199197 // needed to transform svelte files with component imports
200198 // can cause issues with other typescript files, see https://github.com/sveltejs/vite-plugin-svelte/pull/20
201199 extraViteConfig . esbuild = {
@@ -390,7 +388,20 @@ export interface Options {
390388 ignorePluginPreprocessors ?: boolean | string [ ] ;
391389
392390 /**
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+ *
394405 * @default false
395406 */
396407 useVitePreprocess ?: boolean ;
0 commit comments