2019-08-25 10:34:47 +00:00
|
|
|
const path = require('path');
|
|
|
|
|
|
|
|
const {CleanWebpackPlugin} = require('clean-webpack-plugin');
|
2020-06-23 22:19:01 +00:00
|
|
|
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',
|
2019-08-25 10:46:48 +00:00
|
|
|
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$/,
|
2020-06-23 22:19:01 +00:00
|
|
|
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: [
|
2020-06-23 22:19:01 +00:00
|
|
|
new CleanWebpackPlugin(),
|
|
|
|
new MiniCssExtractPlugin({
|
2020-11-02 22:03:45 +00:00
|
|
|
filename: '[name].css'
|
2020-06-23 22:19:01 +00:00
|
|
|
}),
|
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
|
|
|
};
|