question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[bug?] Webpack aliases being ignored.

See original GitHub issue

I have an alias like this in webpack.config.js:

            'common': path.resolve(__dirname, '..', '..', 'common'),

and I have import statements like these in my .scss files:

@import "common/scss/colors";

but it doesn’t work.

If I change it to

@import "../../common/scss/colors";

just like what the Webpack alias defines, then it works!

I can work around the problem by making my own loader, and modifying the @imports to have the unaliased strings, but that’s obviously not desirable.

Possibly related: https://github.com/webpack-contrib/sass-loader/issues/173

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Reactions:18
  • Comments:24 (3 by maintainers)

github_iconTop GitHub Comments

17reactions
vorlovcommented, May 28, 2017

+1 same issue, webpack 2

14reactions
milushovcommented, Mar 4, 2018
Read more comments on GitHub >

github_iconTop Results From Across the Web

Webpack alias is being ignored when module present
I'm aliasing the react-native module as react-native-web like this: webpackConfig.resolve.alias["react-native$ ...
Read more >
Resolve | webpack
Setting resolve.alias to false will tell webpack to ignore a module. module.exports = { //.
Read more >
jsconfig.json Reference - Visual Studio Code
Using webpack aliases. For IntelliSense to work with webpack aliases, you need to specify the paths keys with a glob pattern. For example,...
Read more >
Webpack aliases not resolved when using ... - YouTrack
Webstorm is not resolving the modules even though I have explicitely declared such file as the "webpack configration file" inside the Settings panel....
Read more >
How to Use Webpack's Module Aliasing - Mastering JS
Aliasing is webpack's handy way to shave time and keystrokes off importing frequently used modules. You will need the path module, ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found