resolve aliases in @import work during initial compile but error out during recompiles
See original GitHub issueI have the following alias in my webpack config:
resolve: {
alias: {
'mindfront-react-components': path.join(__dirname, '../mindfront-react-components'),
}
}
I have a sass file using this alias:
@import mindfront-react-components/css3-mixins
When I start up webpack-dev-server for the first time, the sass file compiles just fine. But if I make any changes to it, I get the following error when webpack-dev-server recompiles:
ERROR in ./~/css-loader!./~/sass-loader?indentedSyntax&outputStyle=expanded!./app/components/InventoryList.sass
Module build failed:
@import mindfront-react-components/css3-mixins
^
File to import not found or unreadable: mindfront-react-components/css3-mixins
in /home/andy/jcore-portal/app/components/InventoryList.sass (line 1, column 9)
@ ./app/components/InventoryList.sass 4:14-166 14:20-172
Issue Analytics
- State:
- Created 8 years ago
- Reactions:1
- Comments:9 (3 by maintainers)
Top Results From Across the Web
Webpack resolve alias and compile file under that alias
Problem occurs only for dependencies. Potential solutions. I know that one solution would be to compile each package with webpack - but that ......
Read more >Module Resolution or Import Alias: The Final Guide - Raul Melo
Tired to have weird imports? It's time to learn how can you enable aliases to your imports and let code more organized.
Read more >sass-loader - webpack - JS.ORG
The loader will first try to resolve @import as a relative path. If it cannot be resolved, then the loader will try to...
Read more >how the Python import system works - Ten thousand meters
First, we'll discuss the core concepts of the import system: modules, submodules, packages, from <> import <> statements, relative imports, and ...
Read more >SharePoint Framework development tips: prettify your imports
Readability of such code is not at the best level. A lot of parent relative paths like ... It's a common approach when...
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 Free
Top 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
it looks like a similar issue here with webpack 2:
when I import in a sass file like this:
@import 'Styles/imports';
compile works, but the file imports is not watched.@import '../../../styles/imports';
compile and watch works.
If found in webpack 1 configs that the import should use ~:
@import '~Styles/imports';
this also works for compile and watch. It looks like
@import 'Styles/imports';
is not adding the files to the dependency tree for some reason.Duplicate https://github.com/webpack-contrib/sass-loader/issues/410, If somebody don’t agree please create a separate issue. Thanks for helping
sass-loader
doing better 👍