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.

Ctrl+click (go to file) doesn't work for saas-loader ~ imports (node_modules)

See original GitHub issue

Trying to Ctrl+click on the imported module name fails:

@import '~bootstrap/scss/bootstrap';

with this error:

Unable to open '_bootstrap.scss': File not found (file:///PROJECT/src/styles/~bootstrap/scss/_bootstrap.scss).

The reason is that I’m using webpack with saas-loader, and saas-loader treats an import path starting with ~ as an import from node_modules: https://github.com/webpack-contrib/sass-loader#imports

So the actual location from where the import should be loaded is:

file:///PROJECT/node_modules/bootstrap/scss/_bootstrap.scss

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:5
  • Comments:9 (1 by maintainers)

github_iconTop GitHub Comments

2reactions
mciesincommented, Aug 1, 2019

@penx @aeschli when you prefix your path with ~, webpack not only searches for the file inside the node_modules directory, but also considers aliases defined using webpack.config.js.

This behavior has already been taken into account for JS - you can tell IntelliSense about your aliases using jsconfig. Would it be possible to e.g. retrieve that information for *.scss files?

0reactions
dimitircommented, Nov 15, 2019

try vs code CSS Navigation

Read more comments on GitHub >

github_iconTop Results From Across the Web

Sass-loader not resolving import correctly if other type file ...
scss while resolving imports from main.scss. If I assign the unique name to foo.scss file, it will work fine. Above is the essence...
Read more >
SCSS import paths cannot be resolved
i have a very annoying issue with the import paths in my scss. We are using grunt-sass for compiling several scss files, setting...
Read more >
Sass · Bootstrap v5.0
Utilize our source Sass files to take advantage of variables, maps, mixins, and functions to help you build faster and customize your project....
Read more >
A mostly complete guide to webpack 5 (2020)
A mostly complete guide to webpack's capabilities, always to keep close at hand.
Read more >
Hot Module Replacement - webpack
Now let's update the index.js file so that when a change inside print.js is detected we tell ... If you go ahead and...
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