const merge = require('webpack-merge') const path = require('path') const webpack = require('webpack') const UglifyJSPlugin = require('uglifyjs-webpack-plugin') const MiniCssExtractPlugin = require('mini-css-extract-plugin') const baseConfig = require('./webpack.config') const { getThemeVariables } = require('antd/dist/theme') module.exports = merge(baseConfig, { entry: { index: path.resolve(__dirname, '../src/index.tsx'), publicity: path.resolve(__dirname, '../src/publicity.tsx'), }, output: { publicPath: '/', filename: 'static/js/[name].[hash:8].js', chunkFilename: 'static/js/[name].[hash:8].chunk.js', path: path.resolve(__dirname, '../dist'), }, mode: 'production', devtool: false, module: { rules: [ { test: /\.less$/, use: [ { loader: MiniCssExtractPlugin.loader, }, { loader: 'css-loader', // translates CSS into CommonJS }, { loader: 'less-loader', // compiles Less to CSS options: { lessOptions: { javascriptEnabled: true, }, }, }, ], }, { test: /\.scss$/i, use: [MiniCssExtractPlugin.loader, 'css-loader', 'sass-loader'], exclude: path.resolve(__dirname, '../node_modules'), }, { test: /\.css$/i, use: [MiniCssExtractPlugin.loader, 'css-loader'], }, ], }, plugins: [ new webpack.DefinePlugin({ 'process.env.NODE_ENV': JSON.stringify('production'), }), new MiniCssExtractPlugin({ // Options similar to the same options in webpackOptions.output // both options are optional filename: 'static/css/[name].[contenthash:8].css', chunkFilename: 'static/css/[name].[contenthash:8].chunk.css', }), ], })