Error when import SCSS from node_modules
See original GitHub issueI am using Vue CLI webpack starter.
<style lang="scss">
@import '@material/checkbox/mdc-checkbox';
</style>
This gives me an error
in ./~/css-loader?{"minimize":false,"sourceMap":false}!./~/vue-loader/lib/style-compiler?{"vue":true,"id":"data-v-563a1fd0","scoped":false,"hasInlineConfig":false}!./~/sass-loader/lib/loader.js?{"sourceMap":false}!./~/vue-loader/lib/selector.js?type=styles&index=0!./src/components/Checkbox.vue
Module build failed:
@import '@material/checkbox/mdc-checkbox';
^
File to import not found or unreadable: @material/checkbox/mdc-checkbox.
Parent style sheet: stdin
in /home/nman/Documents/WORK/frontend-dev/mdc-vue-integration/src/components/Checkbox.vue (line 72, column 1)
@ ./~/vue-style-loader!./~/css-loader?{"minimize":false,"sourceMap":false}!./~/vue-loader/lib/style-compiler?{"vue":true,"id":"data-v-563a1fd0","scoped":false,"hasInlineConfig":false}!./~/sass-loader/lib/loader.js?{"sourceMap":false}!./~/vue-loader/lib/selector.js?type=styles&index=0!./src/components/Checkbox.vue 4:14-397 13:3-17:5 14:22-405
@ ./src/components/Checkbox.vue
@ ./src/router/index.js
@ ./src/main.js
@ multi ./build/dev-client ./src/main.js
What is happening? Why so hard to get started?
Issue Analytics
- State:
- Created 6 years ago
- Comments:17 (6 by maintainers)
Top Results From Across the Web
"Error: Can't find stylesheet to import." · Issue #2499 · vitejs/vite ...
This is caused by vite always using package.json to determine which file to load. In the case of SASS, this will usually (if...
Read more >SCSS cannot resolve imports (node_modules) in IDE - YouTrack
SCSS cannot resolve imports (node_modules) in IDE - but actually works on ng serve. Running ng serve reports zero issues and also the...
Read more >Webpack can't resolve @import of scss/css - Stack Overflow
Webpack: getting this error: build failed (from ./node_modules/css-loader/dist/cjs.js):. My Node version was 12.18.3 , where I had the error ...
Read more >Sass Error after upgrading vom v14 to v15 | Infragistics Forums
The following error appears after updating a simple and lean application form v14 to v15 (angular and infragistics, node JS v18):.
Read more >Error when importing scss file - Get Help - Vue Forum
Syntax Error: SassError: expected “;” ... I want variables.scss to be recognized and used in a folder root (assets/scss) other than the ...
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
Are you building for production or development? Are you extracting CSS in one file or inline it? How does your sourcecode look like? Your package.json? Questions over questions…
Because of that my opinion is that you should get a feeling of webpack without any starter - it is too much magic in the first time.
I will help you but please tear down the destructive mood, it is the mdc repo and not Webpack or Vuejs.
I ran into a similar problem and it took longer than I care to admit to figure out haha.
If you are using single page components and the new vue-cli, adding this to the vue.config.js should allow a style section set to a lang of scss to look for files in the node_modules folder without the tilda
I’m far from a webpack guru so if you have any corrections please let me know.