ant-design-vue/build/webpack.site.conf.js

68 lines
1.6 KiB
JavaScript
Raw Normal View History

2019-01-12 03:33:27 +00:00
const path = require('path');
const webpack = require('webpack');
const MiniCssExtractPlugin = require('mini-css-extract-plugin');
2019-01-12 03:33:27 +00:00
const HtmlWebpackPlugin = require('html-webpack-plugin');
const merge = require('webpack-merge');
const baseWebpackConfig = require('./webpack.base.conf');
2018-01-22 07:47:22 +00:00
2018-01-23 10:55:39 +00:00
module.exports = merge(baseWebpackConfig, {
2018-01-22 07:47:22 +00:00
output: {
path: path.resolve(__dirname, '../_site'),
2019-02-16 08:51:21 +00:00
publicPath: '/',
filename: '[name].[contenthash:8].js',
chunkFilename: '[contenthash:8].async.js',
2018-01-22 07:47:22 +00:00
},
module: {
rules: [
{
test: /\.less$/,
use: [
MiniCssExtractPlugin.loader,
'css-loader',
'postcss-loader',
{ loader: 'less-loader', options: { javascriptEnabled: true } },
],
2018-01-22 07:47:22 +00:00
},
2018-01-23 10:55:39 +00:00
{
test: /\.css$/,
use: [MiniCssExtractPlugin.loader, 'css-loader', 'postcss-loader'],
2018-01-23 10:55:39 +00:00
},
2018-01-22 07:47:22 +00:00
],
},
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,
},
},
},
},
2018-01-23 10:55:39 +00:00
plugins: [
new webpack.DefinePlugin({
'process.env': {
NODE_ENV: '"production"',
},
}),
new HtmlWebpackPlugin({
2018-04-04 10:39:21 +00:00
template: './site/index.html',
2018-01-23 10:55:39 +00:00
inject: true,
production: true,
}),
new MiniCssExtractPlugin({
filename: '[name].[contenthash:8].css',
chunkFilename: '[id].[contenthash:8].css',
2018-01-23 10:55:39 +00:00
}),
],
2019-01-12 03:33:27 +00:00
});