-
Notifications
You must be signed in to change notification settings - Fork 27k
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
Sass loader cannot resolve modules from Yarn v2 PNP #15753
Comments
Seems like #6049 was closed rather prematurely. |
Perhaps this could be fixed by using a custom importer: https://github.com/sass/node-sass#importer--v200---experimental |
The issue is that So it tries to look for these
from @evilebottnawi is the module import |
It seems as if the issue originates from const url = "@material/animation/variables";
const request = loaderUtils.urlToRequest(url); // "./@material/animation/variables" This is not the case. So either MWC changes all of their imports to prepend a |
Please do not use You can try https://github.com/arcanis/pnp-webpack-plugin, but I don't know real compatibility |
@merceyz and yes and not https://github.com/webpack-contrib/sass-loader/blob/c6d56e48728eb8d65258e6ee7606507187e0b457/src/utils.js#L234, contains |
@evilebottnawi I switched to Webpack v5 and I got the same error. |
Uses the temporary fix proposed by @4cm4k1 in vercel/next.js#15026, Timer/cssnano-preset-simple#6, and cssnano/cssnano#927. Also temporarily fixes Sass module resolution by using the Yarn v2 nodeLinker option (until it's fixed upstream; see vercel/next.js#15753).
@evilebottnawi The PnP plugin is already installed, the import
Would it make sense to also try these?
Or is this behavior expected and therefor it's an issue with how @material/elevation/_variables.scss declares its import and |
@merceyz that suggestion looks great! According to the Sass lang spec, the |
@nicholaschiang Are you sure what you uses latest version? Where you got list? Anyway adding |
@evilebottnawi there's already a repro linked in the original issue description (it's the default Next.js template with a SCSS import added). And I was using Webpack 5.0.0-beta.22 originally (I can add it to the repro if you want too) by specifying Yarn |
Thanks, I will look at this in near future |
Just note - next.js uses |
Confirmed, it is bug, reproduced with |
Resolution in sass is terrible 😞 |
Fixed, ETA is tomorrow, I found other strange resolution bug (very rare case), anyway you need to update |
Fixed in #16970 |
This issue has been automatically locked due to no recent activity. If you are running into a similar issue, please create a new issue with the steps to reproduce. Thank you. |
Bug report
Describe the bug
Next.js does not resolve SCSS that is imported by my dependencies:
styles/home.module.scss
uses@material/elevation
(this works fine).@material/elevation
uses@material/animation
(this fails).To Reproduce
Steps to reproduce the behavior, please provide code snippets or a repository:
Error
You'll notice that when you run
yarn dev
the Next.js server starts up properlybut the
sass-loader
is unable to resolve my dependency's imports.It seems to import the
@material/elevation
package just fine:But it doesn't seem to be able to import
@material/animation
for the@material/elevation
package:I've had this error before when using Next.js with
MWC but was
able to fix it by specifying an
includePaths
configuration innext.config.js
like so:
Now, I'm not sure how to tell
sass-loader
to use Yarn PNP's module resolution.Expected behavior
Next.js should be able to resolve the Yarn PNP modules.
System information
The text was updated successfully, but these errors were encountered: