-
-
Notifications
You must be signed in to change notification settings - Fork 428
fix: import files directly from scoped npm package #679
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
3da01dd to
c2b5623
Compare
Codecov Report
@@ Coverage Diff @@
## master #679 +/- ##
==========================================
+ Coverage 98.02% 98.06% +0.03%
==========================================
Files 6 6
Lines 152 155 +3
==========================================
+ Hits 149 152 +3
Misses 3 3
Continue to review full report at Codecov.
|
alexander-akait
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
using this we disable aliasing for scoped packages, it is breaking change and bad behavior
|
Thanks for checking out my PR and for sharing that information. Would it be possible to resolve the alias issue by having |
|
Here interesting moment, i think it can be solved new option One note - node-sass/sass support
|
|
@evilebottnawi I think having some configurable option for this would be great! I do have a couple of questions to see if I'm understanding the terminology correctly. Would this If you mean configuring a replacement for If you mean configuring whether I would vote for option 1, configuring/replacing |
|
We can export |
|
Closing in favor of #682 |
This PR contains a:
Motivation / Use-Case
When a scoped NPM package import is encountered, sass-loader will prepare a handful of file variations to import. This results in several checks to import files that do not exist, which considerably hampers expected performance. This can be partially avoided by prefixing NPM packages with
~; however, when this is done inside of external packages, it is not something that can be controlled.This is primarily driven by our use of https://github.com/material-components/material-components-web, which makes extensive use of cross-package imports. ex: https://github.com/material-components/material-components-web/blob/master/packages/mdc-textfield/mdc-text-field.scss#L23-L32
Breaking Changes
This change may effect projects where import paths follow the scoped module naming conventions
@import @someNestedFolder/sassFile, where those import paths do not reside innode_modules. If these are local imports, this issue may be resolved by prepending./to ensure the import is handled relative to the requesting file.Additional Info
Scoped NPM imports do still work without this change, but look-ups are not optimized for the scenario. This can result in hundreds of imports (depending on project) looking for ~6 non-existent files.