Rev 934 | AutorÃa | 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')// const BundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPlugin// change active path hereconst currentPath = {entry: './app/index.js',output: path.join(__dirname, 'public/bundles'),filename: 'applicationBundle.js'}module.exports = {entry: currentPath.entry,output: {path: currentPath.output,filename: currentPath.filename},watch: false,mode: 'production',resolve: {extensions: ['.js', '.jsx', '.scss'],alias: {hooks: path.resolve(__dirname, 'app/hooks/'),store: path.resolve(__dirname, 'app/redux/'),components: path.resolve(__dirname, 'app/components/'),'@buttons': path.resolve(__dirname, 'app/components/UI/buttons/Buttons')}},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})]}}