| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869 |
- /**
- * @author: Yuki Takei <yuki@weseek.co.jp>
- */
- const helpers = require('../src/lib/util/helpers');
- /**
- * Webpack Plugins
- */
- const TerserPlugin = require('terser-webpack-plugin');
- const MiniCssExtractPlugin = require('mini-css-extract-plugin');
- const OptimizeCSSAssetsPlugin = require('optimize-css-assets-webpack-plugin');
- const BundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPlugin;
- /**
- * Webpack Constants
- */
- const ANALYZE = process.env.ANALYZE;
- module.exports = require('./webpack.common')({
- mode: 'production',
- devtool: undefined,
- output: {
- filename: '[name].[chunkhash].bundle.js',
- chunkFilename: '[name].[chunkhash].chunk.js'
- },
- module: {
- rules: [
- {
- test: /\.(css|scss)$/,
- use: [
- MiniCssExtractPlugin.loader,
- 'css-loader',
- { loader: 'postcss-loader', options: {
- sourceMap: false,
- plugins: (loader) => [
- require('autoprefixer')()
- ]
- } },
- 'sass-loader'
- ],
- exclude: [helpers.root('src/client/js/legacy')]
- },
- {
- test: /\.(css|scss)$/,
- use: ['style-loader', 'css-loader', 'sass-loader'],
- include: [helpers.root('src/client/js/legacy')]
- },
- ]
- },
- plugins: [
- new MiniCssExtractPlugin({
- filename: '[name].[hash].css',
- }),
- new BundleAnalyzerPlugin({
- analyzerMode: ANALYZE ? 'static' : 'disabled',
- reportFilename: helpers.root('report/bundle-analyzer.html'),
- openAnalyzer: false,
- }),
- ],
- optimization: {
- minimizer: [
- new TerserPlugin({}),
- new OptimizeCSSAssetsPlugin({})
- ],
- },
- });
|