-
-
Notifications
You must be signed in to change notification settings - Fork 429
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
Cannot import scoped node_module packages #293
Comments
When you write
webpack will search at |
That is exactly what I was expecting. The module is installed at the path you noted but it is not found. When installing scope modules, their package name is scoped and they are installed to the scope folder (@TechnologyAdvice). The only way I could get this to work was to move the module up out of the scope folder into the root of node_modules. |
What does the |
|
Again, the curious thing here is that it works just fine when it is not in a |
@jhnns We are encountering this exact problem as of In addition; the scoped node_module import syntax works when importing using a reference to a specific file, i.e. Any thoughts or updates? Thanks! |
I assume that this is a webpack problem because the sass-loader is not resolving it. Could you create a minimal example that reproduces the error? Just commit a small example node_modules folder with the folder structure. Try to remove as much as possible. |
Same problem using material components web. Looks like the This remembered me that so basically webpack is not contemplating A workaround for resolve that is include the scoped paths into loader: 'sass-loader',
options: {
sourceMap: true,
includePaths: ['node_modules', 'node_modules/@material/*']
.map((d) => path.join(__dirname, d))
.map((g) => glob.sync(g))
.reduce((a, c) => a.concat(c), [])
} and then you can do: import '@material/card/mdc-card' but ideally, avoid this specific configuration. |
When importing a scoped node_module package with the tilde syntax:
The following error is produced:
I moved the module to
node_modules/radiant
, updated itspackage.json
fields to remove its scoping, and then@import '~radiant';
and it worked. My guess is that the@
is causing some issue.The text was updated successfully, but these errors were encountered: