Rev 5580 | Rev 5682 | Ir a la última revisión | Autoría | Comparar con el anterior | Ultima modificación | Ver Log |
const path = require("path");const isDevelopment = process.env.NODE_ENV === "development";const MiniCssExtractPlugin = require("mini-css-extract-plugin");const TerserPlugin = require("terser-webpack-plugin");// Add paths while bundlingconst paths = {menu: {entry: "./react-webpack/menu/index.js",output: path.join(__dirname, "public/react-bundles/menu"),filename: "menuBundle.js",},companySizes: {entry: "./react-webpack/settings/company-sizes/index.js",output: path.join(__dirname, "public/react-bundles/settings/company-sizes"),filename: "companySizesBundle.js",},competencyTypes: {entry: "./react-webpack/settings/competency-types/index.js",output: path.join(__dirname, "public/react-bundles/settings/competency-types"),filename: "competencyTypesBundle.js",},groupTypes: {entry: "./react-webpack/settings/groups-types/index.js",output: path.join(__dirname, "public/react-bundles/settings/group-types"),filename: "groupTypesBundle.js",},industries: {entry: "./react-webpack/settings/industries/index.js",output: path.join(__dirname, "public/react-bundles/settings/industries"),filename: "industriesBundle.js",}};// change active path hereconst currentPath = paths.industries;module.exports = {entry: currentPath.entry,output: {path: currentPath.output,filename: currentPath.filename,},watch: isDevelopment ? true : false,mode: isDevelopment ? "development" : "production",resolve: {extensions: [".js", ".jsx", ".scss"],},module: {rules: [{test: /(js|jsx)$/,use: ["babel-loader"],exclude: /node_modules/,},{test: /\.css$/i,use: [MiniCssExtractPlugin.loader, "css-loader"],},{test: /\.module\.s(a|c)ss$/,use: [MiniCssExtractPlugin.loader,{loader: "css-loader",options: {modules: {localIdentName: "[local]--[hash:base64:5]",},sourceMap: isDevelopment,},},{loader: "sass-loader",options: {sourceMap: isDevelopment,},},],},{test: /\.s(a|c)ss$/,exclude: /\.module.(s(a|c)ss)$/,use: [MiniCssExtractPlugin.loader,"css-loader",{loader: "sass-loader",options: {sourceMap: isDevelopment,},},],},],},plugins: [new MiniCssExtractPlugin({filename: "[name].css",chunkFilename: "[id].css",}),],optimization: {minimizer: [new TerserPlugin({extractComments: false,}),],},};