diff --git a/sites/svelte-5-preview/src/lib/Output/CompilerOptions.svelte b/sites/svelte-5-preview/src/lib/Output/CompilerOptions.svelte index 5f244a07fc..60504c5052 100644 --- a/sites/svelte-5-preview/src/lib/Output/CompilerOptions.svelte +++ b/sites/svelte-5-preview/src/lib/Output/CompilerOptions.svelte @@ -1,6 +1,7 @@ @@ -16,6 +17,12 @@ + + }); diff --git a/sites/svelte-5-preview/src/lib/Repl.svelte b/sites/svelte-5-preview/src/lib/Repl.svelte index 5922a63ea8..ff144d5d32 100644 --- a/sites/svelte-5-preview/src/lib/Repl.svelte +++ b/sites/svelte-5-preview/src/lib/Repl.svelte @@ -76,7 +76,8 @@ /** @type {import('svelte/compiler').CompileOptions} */ const DEFAULT_COMPILE_OPTIONS = { - generate: 'client' + generate: 'client', + dev: false }; /** @type {Map} */ diff --git a/sites/svelte-5-preview/src/lib/workers/bundler/index.js b/sites/svelte-5-preview/src/lib/workers/bundler/index.js index 1e5c6cc02c..15c43529cf 100644 --- a/sites/svelte-5-preview/src/lib/workers/bundler/index.js +++ b/sites/svelte-5-preview/src/lib/workers/bundler/index.js @@ -387,7 +387,8 @@ async function get_bundle(uid, mode, cache, local_files_lookup) { } else if (id.endsWith('.svelte')) { result = svelte.compile(code, { filename: name + '.svelte', - generate: 'client' + generate: 'client', + dev: true }); if (result.css) { @@ -400,7 +401,11 @@ async function get_bundle(uid, mode, cache, local_files_lookup) { `.replace(/\t/g, ''); } } else if (id.endsWith('.svelte.js')) { - result = svelte.compileModule(code, { filename: name + '.js', generate: 'client' }); + result = svelte.compileModule(code, { + filename: name + '.js', + generate: 'client', + dev: true + }); if (!result) { return null; } @@ -420,7 +425,7 @@ async function get_bundle(uid, mode, cache, local_files_lookup) { warnings.push(warning); }); - /** @type {import('rollup').TransformResult} */ + /** @type {import('@rollup/browser').TransformResult} */ const transform_result = { code: result.js.code, map: result.js.map diff --git a/sites/svelte-5-preview/src/lib/workers/compiler/index.js b/sites/svelte-5-preview/src/lib/workers/compiler/index.js index 0563cdaffd..56ff247161 100644 --- a/sites/svelte-5-preview/src/lib/workers/compiler/index.js +++ b/sites/svelte-5-preview/src/lib/workers/compiler/index.js @@ -59,7 +59,8 @@ function compile({ id, source, options, return_ast }) { if (options.filename.endsWith('.svelte')) { const compiled = svelte.compile(source, { filename: options.filename, - generate: options.generate + generate: options.generate, + dev: options.dev }); const { js, css, warnings, metadata } = compiled; @@ -77,7 +78,8 @@ function compile({ id, source, options, return_ast }) { } else if (options.filename.endsWith('.svelte.js')) { const compiled = svelte.compileModule(source, { filename: options.filename, - generate: options.generate + generate: options.generate, + dev: options.dev }); if (compiled) { diff --git a/sites/svelte-5-preview/src/lib/workers/jsconfig.json b/sites/svelte-5-preview/src/lib/workers/jsconfig.json new file mode 100644 index 0000000000..60351b7548 --- /dev/null +++ b/sites/svelte-5-preview/src/lib/workers/jsconfig.json @@ -0,0 +1,9 @@ +{ + "include": ["./**/*"], + "compilerOptions": { + "paths": { + "svelte": ["../../../static/svelte/main"], + "svelte/*": ["../../../static/svelte/*"] + } + } +}