-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Description
Proposal
Add support for tilde character to import a module from node_modules.
Current workaround of 'includePath` makes the build inefficient when we have
e.g. in my styles.scss I can do the following
@import '~bootstrap-sass/assets/stylesheets/bootstrap/alerts';
instead of
@import 'bootstrap-sass/assets/stylesheets/bootstrap/alerts';
and somewhere
incudePaths: ['./node_modules'']
My guess is that this inefficiency increases when we have many npm modules as dependencies since the search operation has to search inside the entire node_modules. Trying to improve some efficiency to narrow includePaths is very fragile because the libraries we import may import other libraries and can't be really done without trial and error or having a full knowledge of all the artifacts and their nested imports which defeats the purpose of having libraries in the first place.
Side note: Some build systems have added this feature e.g. https://github.com/webpack-contrib/sass-loader. However those who do not use webpack are at loss.