-
-
Notifications
You must be signed in to change notification settings - Fork 6.3k
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
Cannot import Sass modules from node_modules: "Error: Can't find stylesheet to import." #2499
Comments
Vite doesn't recognize |
Also just came across this when installing The workaround, for any For example...
Or...
|
I have some cases where I can't seem to use the workaround with @import 'node_modules/@material/data-table/mixins'; This returns the following error:
Since the imported file is also trying to import additional packages, it runs into the same issue of not recognizing |
This is caused by vite always using |
Using 9:09:10 AM [vite] Internal server error: Can't find stylesheet to import.
╷
1 │ @use "@material/icon-button";
│ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
╵
style.scss 1:1 root stylesheet
Plugin: vite:css
File: /Users/christopher/OpenSource/vite-repros/issue-2499/style.scss
Error: Can't find stylesheet to import.
╷
1 │ @use "@material/icon-button";
│ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
╵
style.scss 1:1 root stylesheet
at Object._newRenderError (/Users/christopher/OpenSource/vite-repros/issue-2499/node_modules/sass/sass.dart.js:13190:19)
at Object._wrapException (/Users/christopher/OpenSource/vite-repros/issue-2499/node_modules/sass/sass.dart.js:13018:16)
at _render_closure1.call$2 (/Users/christopher/OpenSource/vite-repros/issue-2499/node_modules/sass/sass.dart.js:81626:21)
at _RootZone.runBinary$3$3 (/Users/christopher/OpenSource/vite-repros/issue-2499/node_modules/sass/sass.dart.js:27456:18)
at _FutureListener.handleError$1 (/Users/christopher/OpenSource/vite-repros/issue-2499/node_modules/sass/sass.dart.js:26005:19)
at _Future__propagateToListeners_handleError.call$0 (/Users/christopher/OpenSource/vite-repros/issue-2499/node_modules/sass/sass.dart.js:26303:49)
at Object._Future__propagateToListeners (/Users/christopher/OpenSource/vite-repros/issue-2499/node_modules/sass/sass.dart.js:4544:77)
at _Future._completeError$2 (/Users/christopher/OpenSource/vite-repros/issue-2499/node_modules/sass/sass.dart.js:26135:9)
at _AsyncAwaitCompleter.completeError$2 (/Users/christopher/OpenSource/vite-repros/issue-2499/node_modules/sass/sass.dart.js:25789:12)
at Object._asyncRethrow (/Users/christopher/OpenSource/vite-repros/issue-2499/node_modules/sass/sass.dart.js:4343:17) After applying #3627 I only get a deprecation warning: DEPRECATION WARNING: Using / for division is deprecated and will be removed in Dart Sass 2.0.0.
Recommendation: math.div(math.max($backLum, $foreLum), math.min($backLum, $foreLum))
More info and automated migrator: https://sass-lang.com/d/slash-div
╷
49 │ @return math.max($backLum, $foreLum) / math.min($backLum, $foreLum);
│ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
╵
node_modules/@material/theme/_theme-color.scss 49:11 contrast()
node_modules/@material/theme/_theme-color.scss 60:19 tone()
node_modules/@material/theme/_theme-color.scss 73:14 contrast-tone()
node_modules/@material/theme/_theme-color.scss 115:17 @use
node_modules/@material/theme/_theme.scss 35:1 @use
node_modules/@material/ripple/_ripple.scss 33:1 @use
node_modules/@material/icon-button/_mixins.scss 29:1 @forward
node_modules/@material/icon-button/_index.scss 2:1 @use
style.scss 1:1 root stylesheet But this is not related to vite anymore if I understand correctly |
Describe the bug
Trying to import sass module from an mdc component, using the following syntax:
I get the following error:
To fix it, I need to specify the node_modules folder, like this:
I tried to configure the "includePath" in vite.config.js, but it does not solve the issue or maybe my syntax is not correct ?:
It looks pretty much like #291 which was solved. Could it be a regression maybe ?
Reproduction
npm init @vitejs/app
vanilla optionnpm install -D sass
npm install @material/icon-button
npm run dev
The error appears.
System Info
vite
version: 2.0.5Logs (Optional if provided reproduction)
vite
orvite build
with the--debug
flag.Thanks for your help !
The text was updated successfully, but these errors were encountered: