You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
ant-design-vue/webpack.site.config.js

68 lines
1.7 KiB

const path = require('path');
const webpack = require('webpack');
const MiniCssExtractPlugin = require('mini-css-extract-plugin');
const HtmlWebpackPlugin = require('html-webpack-plugin');
const merge = require('webpack-merge');
const baseWebpackConfig = require('./webpack.base.config');
7 years ago
7 years ago
module.exports = merge(baseWebpackConfig, {
7 years ago
output: {
7 years ago
path: path.resolve(__dirname, './site-dist'),
publicPath: '/ant-design-vue/',
filename: '[name].[contenthash:8].js',
chunkFilename: '[contenthash:8].async.js',
7 years ago
},
module: {
rules: [
{
test: /\.less$/,
use: [
MiniCssExtractPlugin.loader,
'css-loader',
'postcss-loader',
{ loader: 'less-loader', options: { javascriptEnabled: true } },
],
7 years ago
},
7 years ago
{
test: /\.css$/,
use: [MiniCssExtractPlugin.loader, 'css-loader', 'postcss-loader'],
7 years ago
},
7 years ago
],
},
optimization: {
splitChunks: {
cacheGroups: {
vendors: {
name: `chunk-vendors`,
test: /[\\/]node_modules[\\/]/,
priority: -10,
chunks: 'initial',
},
common: {
name: `chunk-common`,
minChunks: 2,
priority: -20,
chunks: 'initial',
reuseExistingChunk: true,
},
},
},
},
7 years ago
plugins: [
new webpack.DefinePlugin({
'process.env': {
NODE_ENV: '"production"',
},
}),
new HtmlWebpackPlugin({
7 years ago
template: './site/index.html',
7 years ago
inject: true,
production: true,
}),
new MiniCssExtractPlugin({
filename: '[name].[contenthash:8].css',
chunkFilename: '[id].[contenthash:8].css',
7 years ago
}),
],
});