Inflearn コミュニティ Q&A
next.config.js sass 적용 질문
作成
·
301
0
next.config.js 에서
제가 잘못한건지... styled-components 적용하려고 하면 화면이 깜빡거리는 것 같은 현상을 겪어서
sass 로적용해보려고
@zeit/next-sass, @zeit/next-css 설치 후
기존 코드에
const withSass = require('@zeit/next-sass');
const withCSS = require('@zeit/next-css');
module.exports = withCSS(
withSass(
withBundleAnalyzer({
distDir: '.next',
webpack(config) {
const prod = process.env.NODE_ENV === 'production';
const plugins = [...config.plugins];
if (prod) {
plugins.push(new CompressionPlugin());
}
config.module.rules.push({
test: /\.(png|jpg|gif|svg|eot|ttf|woff|woff2)$/,
use: {
loader: 'url-loader',
options: {
limit: 100000,
},
},
});
return {
...config,
mode: prod ? 'production' : 'development',
devtool: prod ? 'hidden-source-map' : 'eval',
plugins,
};
},
}),
),
);
저런식으로 적용했는데 되질 않아서 ㅠㅠ 질문드려요 ㅠㅠ...
새로 프로젝트 만들어서 해보면 거기서는 적용이 되는데
지금 구조에서는 이게 불가능한건지... 암튼 도통 감이오질 않아 여쭙니다 ㅠㅠ
javascriptreact
回答 3
1
zerocho
インストラクター
styled-components 적용하려고 할 때 화면이 깜빡거리는 것 같은 현상은 SSR이 제대로 적용되지 않아서 그렇습니다. 단, antd의 경우는 SSR을 지원하지 않는 컴포넌트도 있어, antd 컴포넌트가 깜빡거리는 것을 막는 것은 어렵습니다.
1
0





