Closed svenvandescheur closed 2 years ago
For me this helped, since vite module resolution tries to be consistent within stylesheet imports and JS imports and doesn' understand the very common usage of "~" in sass or scss. Add this to your defineConfig
:
resolve: {
alias: [
{
// this is required for the SCSS modules
find: /^~(.*)$/,
replacement: '$1',
},
],
},
But be aware that this may collide with other aliases you want to support in your JS files.
~
is not a feature of sass. It is implemented in sass-loader
and others.
https://github.com/webpack-contrib/sass-loader#resolving-import-at-rules
https://github.com/heyymarco/tilde-sass
Describe the bug
Seems to be unresolved in latest release (2.6.14): https://github.com/vitejs/vite/issues/2499.
This issue has been reported before, and since the original issue is closed I assume it has a patch. However I encounter the same behaviour when attempting to load a css file from Leaflet.
Reproduction
System Info
Used Package Manager
npm
Logs
Validations