wiki/editor/webpack.config.js

64 lines
1.4 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');
2019-08-25 10:34:47 +00:00
module.exports = {
mode: 'development',
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: [
{
2019-08-25 12:45:43 +00:00
test: /\.s?css$/,
use: [MiniCssExtractPlugin.loader, 'css-loader', 'sass-loader']
2020-05-20 21:08:34 +00:00
},
{
test: /\.(woff|woff2|eot|ttf|otf)$/,
loader: "file-loader",
options: {
name: '[name].[ext]',
outputPath: 'font/'
}
2019-08-25 10:34:47 +00:00
}
]
},
plugins: [
new CleanWebpackPlugin(),
new MiniCssExtractPlugin({
2020-11-02 22:03:45 +00:00
filename: '[name].css'
}),
2019-08-25 10:34:47 +00:00
],
devServer: {
contentBase: './dist',
hot: true
},
2020-10-31 13:02:14 +00:00
optimization: {
splitChunks: {
cacheGroups: {
commons: {
test: /[\\/]node_modules[\\/]/,
name: 'vendors',
chunks: 'all'
2020-11-02 22:03:45 +00:00
},
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
};