1) client
2) nodejs
package.json
에 해당 내용 들어있어야 함
"scripts": {
"dev": "next -p 3000",
"build": "next build",
"start": "next start"
},
npm run build
npm i @next/bundle-analyzer
const withBundleAnalyzer = require("@next/bundle-analyzer")({
enabled: process.env.ANALYZE === "true",
});
module.exports = withBundleAnalyzer({
compress: true,
webpack(config, { webpack }) {
const prod = process.env.NODE_ENV === "production";
return {
...config,
mode: prod ? "production" : "development",
devtool: prod ? "hidden-source-map" : "eval-source-map",
plugins: [
...config.plugins,
new webpack.ContextReplacementPlugin(/moment[/\\]locale$/, /^\.\/ko$/),
],
};
},
});
npm i cross-env
package.json
에 내용 수정
"scripts": {
"dev": "next -p 3000",
"build": "cross-env ANALYZE=true NODE_ENV=production next build",
"start": "next start"
},