|
|
|
@ -1,6 +1,11 @@
|
|
|
|
|
const path = require('path'); |
|
|
|
|
const glob = require('glob'); |
|
|
|
|
|
|
|
|
|
const HtmlWebpackPlugin = require('html-webpack-plugin'); |
|
|
|
|
|
|
|
|
|
const MiniCssExtractPlugin = require('mini-css-extract-plugin'); |
|
|
|
|
const PurgecssPlugin = require('purgecss-webpack-plugin'); |
|
|
|
|
|
|
|
|
|
module.exports = { |
|
|
|
|
entry: './src/app.ts', |
|
|
|
|
module: { |
|
|
|
@ -12,7 +17,7 @@ module.exports = {
|
|
|
|
|
}, |
|
|
|
|
{ |
|
|
|
|
test: /\.css$/i, |
|
|
|
|
use: ["style-loader", "css-loader"], |
|
|
|
|
use: [MiniCssExtractPlugin.loader, "css-loader"], |
|
|
|
|
}, |
|
|
|
|
], |
|
|
|
|
}, |
|
|
|
@ -28,19 +33,12 @@ module.exports = {
|
|
|
|
|
new HtmlWebpackPlugin({ |
|
|
|
|
template: './src/index.html', |
|
|
|
|
hash: true |
|
|
|
|
}), |
|
|
|
|
new MiniCssExtractPlugin({ |
|
|
|
|
filename: "[name].css", |
|
|
|
|
}), |
|
|
|
|
new PurgecssPlugin({ |
|
|
|
|
paths: glob.sync('./src/**/*', { nodir: true }), |
|
|
|
|
}) |
|
|
|
|
], |
|
|
|
|
optimization: { |
|
|
|
|
moduleIds: 'deterministic', |
|
|
|
|
runtimeChunk: 'single', |
|
|
|
|
splitChunks: { |
|
|
|
|
cacheGroups: { |
|
|
|
|
vendor: { |
|
|
|
|
test: /[\\/]node_modules[\\/]/, |
|
|
|
|
name: 'vendors', |
|
|
|
|
chunks: 'all', |
|
|
|
|
}, |
|
|
|
|
}, |
|
|
|
|
}, |
|
|
|
|
}, |
|
|
|
|
] |
|
|
|
|
}; |
|
|
|
|