-
Notifications
You must be signed in to change notification settings - Fork 91
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
Import through SASS URL does not work #177
Comments
Thank you for the report and a reproduction repository! It looks like Next.js 9.5 broke it but I just published a patch ( |
That was fast - works perfectly! Thanks! |
This problem is back :( |
Yeah, looks like this is occurring again. |
Thanks to @jamesrwaugh, downgrading nextjs to v10.2.0 is a workaround for the moment. |
I've downgraded to 10.2.0 and the issue still persist, is there another solution? |
Same here... "next": "^10.2.3" The file path in css is Notice that the file path include a 'media' path name. The generated file content is: |
Refer #247, adding webpack config to next.config.js worked with next v11.1. module.exports = withOptimizedImages({
webpack: (config, { isServer }) => {
// https://github.com/cyrilwanner/next-optimized-images/issues/177
// https://github.com/cyrilwanner/next-optimized-images/pull/247
if (!isServer) {
config.module.rules.forEach((rule) => {
if (rule.oneOf) {
rule.oneOf.forEach((subRule) => {
if (
subRule.issuer && !subRule.test && !subRule.include && subRule.exclude
&& subRule.use && subRule.use.options && subRule.use.options.name
) {
if (
String(subRule.issuer) === '/\\.(css|scss|sass)(\\.webpack\\[javascript\\/auto\\])?$/'
&& subRule.use.options.name.startsWith('static/media/')
) {
subRule.exclude.push(/\.(jpg|jpeg|png|svg|webp|gif|ico)$/);
}
}
});
}
});
}
return config;
},
}); |
Hey!
It seems #139 does not work anymore.
background-image: url("../images/foo.png")
producesbackground-image: url(/_next/static/media/foo.726e2e59f6a1cfa166389ffe7a6410cd.png);
.Content of that file is:
And file
/_next/static/images/foo-12d36cacee9c32b1e682cf2a02894e1e.png
does exist and is correct.The reproduced issue here: https://github.com/minvs1/nextjs-sass-image-bug
The text was updated successfully, but these errors were encountered: