sass-loader icon indicating copy to clipboard operation
sass-loader copied to clipboard

Clarifying: Resolving import at-rules not resolving webpack's resolve.modules?

Open chardskarth opened this issue 2 years ago • 3 comments

Documentation Is: It's mentioned here that resolution is done:

  1. First, by resolving as a relative path
  2. If not found, it will try to search through the node_modules directory.
  • [x] Missing
  • [ ] Needed
  • [ ] Confusing
  • [x] Not Sure?

Please Explain in Detail...

I think it should be mentioned that webpack's alias is tried to be resolved before the "node_module" resolution part.

Which brings me to my next question: Is it expected that webpack's resolve.modules is not used as an alternative for resolution?

Your Proposal for Changes

Indicate, under Webpack provides an [advanced mechanism to resolve files](https://webpack.js.org/concepts/module-resolution/). that specifying a resolution via webpack's resolve alias can be used.

chardskarth avatar Jun 10 '22 06:06 chardskarth

@chardskarth Yes, alias is prefered, it was simplifed to show ~ changes, resolving logic is more complex, even more you can change node_modules and inject own plugins to resolver

alexander-akait avatar Jun 10 '22 12:06 alexander-akait

@alexander-akait is it a future improvement to support webpack's resolve.modules option?

chardskarth avatar Aug 25 '22 12:08 chardskarth

I mean you are right, but if we want describe all resolver's steps it will be very big and complex, anyway if you want to improve docs - feel free to send a PR

alexander-akait avatar Aug 29 '22 13:08 alexander-akait