I'm using Svelte with Rollup, and trying to get scss to work importing an alias, or with global import. My app compiles just fine. But the problem is, VSCode (or svelte extension, i don't know) doesn't recognize aliases, and says my file has errors. I can still run my app, but every single file looks red.
Attempt 1
I tried making an alias and importing via it
// jsconfig.json
{
"compilerOptions": {
"baseUrl": ".",
"paths": {
"src/*": [
"src/*"
],
}
}
}
// App.svelte
<style lang="scss">
@import "src/style/theme.scss"; // Error: Can't find stylesheet to import
</style>
Attempt 2
Tried prepending the import to every single file
// rollup.config.js
const config = {
plugins: [
svelte({
preprocess: sveltePreprocess({
scss: {
prependData: `@import './src/style/theme.scss';`,
includePaths: [path.resolve(__dirname)],
},
}),
]
}
// src/style/theme.scss
$black: #000000;
// App.svelte
<style lang='scss'>
color: $black // Error: undefined variable
</style>
Both attempts work when compiling, but VSCode keeps saying there's errors. How do I stop VSCode from not understanding? I'd rather stick to Attempt 1, but any way I can solve this I'm fine.