-
-
Notifications
You must be signed in to change notification settings - Fork 4.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
compilerOptions runes per directory #12327
Comments
Seems to be a duplicate of #11523 compilerOptions: {
runes: true
},
vitePlugin: {
dynamicCompileOptions({ filename }) {
if (filename.includes('node_modules')) {
return { runes: false };
}
}
}, |
Thanks for sharing the dynamicCompilerOptions in the vite plugin, but at the moment that is a worse workaround than using a preprocessor:
Flipping the condition doesn't have the desired effect:
The warnings are visible in the terminal that's running That's because VSCode applies the preprocessors but doesn't seem to apply the dynamicCompileOptions. |
Describe the problem
When enabling rune mode:
You're getting consistent behavior and are getting useful hint like:
'x' is updated, but is not declared with '$state(...)'. Changing its value will not correctly trigger updates
for your Svelte components which is great!
However this compilerOption is enabled globally so all npm packages that are not using runes will fail to compile with errors like:
Cannot use 'export let' in runes mode — use '$props()' instead
Describe the proposed solution
Ideas:
Dynamic options via a callback
.htaccess style
Additional svelte.config.js files compilerOptions are combined, also allows packages to specify behavior.
Remove the runes from compilerOptions?
Developer are expected to add
<svelte:options runes={true} />
when not using any runes in a file.Preprocessor workaround
I've written a simple preprocessor that injects
<svelte:options runes />
tags into files that don't have a<svelte:option />
tag based on it filename.https://github.com/bfanger/svelte-project-template/blob/31b9982286f7c15280775fce83bd3b5f14fc3a42/src/runesMode.js
Importance
nice to have
The text was updated successfully, but these errors were encountered: