Does not respect default language in svelte.config.js
See original GitHub issueDescribe the bug
My svelte.config.js
file looks like this:
import sveltePreprocess from "svelte-preprocess";
module.exports = {
preprocess: sveltePreprocess({
defaults: {
script: "typescript",
style: "scss",
},
postcss: {
plugins: [require("autoprefixer")()],
},
}),
};
Expected behavior
It is showing me that you have to add lang='ts'
to svelte file that looks something like this:
<script>
export let segment: string;
</script>
{segment}
Screenshots
System (please complete the following information):
- OS: Windows
- IDE: VSCode
- Plugin/Package: Svelte for VSCode
Issue Analytics
- State:
- Created 3 years ago
- Comments:11 (7 by maintainers)
Top Results From Across the Web
How to Localize a Svelte App with svelte-i18n | Phrase
Arabic is a right-to-left language, and the UI just looks awkward in that locale now. Let's fix this by adding another derived store...
Read more >Build Setup Recipes
Svelte doesn't build in any opinions on the kind of JavaScript, CSS, or even HTML you write. Therefore, if you want to use...
Read more >rollup.js
A config file is an ES module that exports a default object with the desired options: export default { input: 'src/main.js', output: {...
Read more >svelte-preprocess - npm
svelte-vscode needs to know how its (svelte) language server should preprocess your files. This can be achieved by creating a svelte.config.js ...
Read more >Dynamic behavior in Svelte: working with variables and props
You can also specify a default initial value for a prop. This will be used if the component's consumer doesn't specify the prop...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
See #509 for more info on this. Also you are allowed to import CommonJS modules from ES modules, you just need to change your file ending to become
svelte.config.cjs
.Importing
svelte.config.js
as an ES6 module should be something that is possible. Not being able to use svelte.config.js so we can have LSP support due to being limited to by CJS is a real pain point in adopting svelte, particularly when the rest of the ecosystem is moving forward with adopting ES6 so everything can stop being so fragmented.Node recognizes
type: "module"
from package.json so CJS and module loading at that point become irreconcilable.What would the blocker be? Is this a LSP issue? Or is it a
rollup
plugin issue (with thesvelte
rollup plugin or thesvelte-preprocess
rollup plugin)?