1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465 |
- 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',
- }),
- ],
- })
|