const nrwlConfig = require("@nrwl/react/plugins/webpack.js"); const CompressionPlugin = require("compression-webpack-plugin"); const HtmlWebpackPlugin = require("html-webpack-plugin"); module.exports = (config) => { nrwlConfig(config); if (config.mode === "production") { config.plugins.push( new CompressionPlugin({ threshold: 8192 }) ); config.plugins.push( new HtmlWebpackPlugin({ template: "index.html", scriptLoading: "module" }) ); config.optimization = { ...config.optimization, splitChunks: { ...config.optimization.splitChunks, cacheGroups: { ...config.optimization.splitChunks.cacheGroups, mui: { test: /[\\/]node_modules[\\/]@mui/, name: 'vendor.mui', chunks: 'all', priority: 15 }, fortawesome: { test: /[\\/]node_modules[\\/]@fortawesome/, name: 'vendor.fortawesome', chunks: 'all', priority: 20 } } }, } } return { ...config, }; };