wiki/editor/webpack.config.js

84 lines
2.2 KiB
JavaScript
Raw Normal View History

2019-08-25 10:34:47 +00:00
const path = require('path');
const {CleanWebpackPlugin} = require('clean-webpack-plugin');
const MiniCssExtractPlugin = require('mini-css-extract-plugin');
const ProgressBarPlugin = require('progress-bar-webpack-plugin');
const webpack = require('webpack');
2019-08-25 10:34:47 +00:00
module.exports = env => {
return {
// mode: 'production',
// devtool: 'source-map',
// entry: {
// index: './src/index.js'
// },
// output: {
// filename: '[name].bundle.js',
// path: path.resolve(__dirname, '../dist')
// },
2019-08-25 10:34:47 +00:00
module: {
rules: [
{
test: /\.s?css$/,
use: [MiniCssExtractPlugin.loader, 'css-loader', 'sass-loader']
},
{
test: /\.(woff|woff2|eot|ttf|otf)$/,
type: 'asset/resource'
2020-05-20 21:08:34 +00:00
}
]
},
2019-08-25 10:34:47 +00:00
stats: {
orphanModules: true
},
2019-08-25 10:34:47 +00:00
resolve: {
fallback: {
util: require.resolve("util/")
}
},
2020-10-31 13:02:14 +00:00
plugins: [
// new ProgressBarPlugin(),
// new CleanWebpackPlugin(),
new MiniCssExtractPlugin({
filename: '[name].css'
}),
new webpack.EnvironmentPlugin({
DEBUG: false,
NODE_DEBUG: false,
2021-08-15 22:06:20 +00:00
}),
new webpack.IgnorePlugin({
resourceRegExp: /^\.\/locale$/,
contextRegExp: /moment$/,
})
],
//
// devServer: {
// contentBase: './dist',
// hot: true
// },
//
optimization: {
usedExports: true,
2021-08-15 22:06:20 +00:00
splitChunks: {
cacheGroups: {
commons: {
test: /[\\/]node_modules[\\/]/,
name: 'vendors',
chunks: 'all'
},
styles: {
name: 'styles',
test: /\.css$/,
chunks: 'all',
enforce: true,
},
}
}
2020-10-31 13:02:14 +00:00
}
}
2019-08-25 10:34:47 +00:00
};