admin管理员组文章数量:1122846
Having an issue with Next.js regarding its Webpack and how it handles SCSS APP.
When I'm adding this to my next.config.ts
:
webpack(config, { isServer }) {
if (!isServer) {
config.module.rules.push({
test: /\.scss$/,
use: ["style-loader", "css-loader", "sass-loader"],
});
}
return config;
},
I get no errors at all, but styles aren't applied to any DOM element. I mean it is showing as a class using devtools but the element doesn't change at all and doesn't recognize any rule at all.
But if I remove this code above, everything works but then I get error of this:
Import trace for requested module:
./src/UI/Button/Button.module.scss.webpack[javascript/auto]!=!./node_modules/next/dist/build/webpack/loaders/css-loader/src/index.js??ruleSet[1].rules[13].oneOf[7].use[2]!./node_modules/next/dist/build/webpack/loaders/postcss-loader/src/index.js??ruleSet[1].rules[13].oneOf[7].use[3]!./node_modules/next/dist/build/webpack/loaders/resolve-url-loader/index.js??ruleSet[1].rules[13].oneOf[7].use[4]!./node_modules/next/dist/compiled/sass-loader/cjs.js??ruleSet[1].rules[13].oneOf[7].use[5]!./src/UI/Button/Button.module.scss
./src/UI/Button/Button.module.scss
本文标签: nextjsHow to correctly implement scsssassStack Overflow
版权声明:本文标题:next.js - How to correctly implement scsssass? - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1736309645a1934091.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论