Fix webpack config to work with installed webpack version

This commit is contained in:
Franck 2022-01-03 12:15:00 +11:00
parent 6978121a7d
commit 230d5ceab2
No known key found for this signature in database
GPG Key ID: A82ED75A8DFC50A4
1 changed files with 11 additions and 9 deletions

View File

@ -1,4 +1,3 @@
const path = require('path')
const HtmlWebpackPlugin = require('html-webpack-plugin') const HtmlWebpackPlugin = require('html-webpack-plugin')
const ForkTsCheckerWebpackPlugin = require('fork-ts-checker-webpack-plugin') const ForkTsCheckerWebpackPlugin = require('fork-ts-checker-webpack-plugin')
const webpack = require('webpack') const webpack = require('webpack')
@ -14,7 +13,6 @@ module.exports = (env) => {
entry: './src/index.tsx', entry: './src/index.tsx',
output: { output: {
filename: 'index.[fullhash].js', filename: 'index.[fullhash].js',
path: path.join(__dirname, 'dist'),
publicPath: "/", publicPath: "/",
}, },
devtool: 'source-map', devtool: 'source-map',
@ -52,11 +50,11 @@ module.exports = (env) => {
}, },
optimization: { optimization: {
minimizer: [ minimizer: [
new ESBuildMinifyPlugin({ new ESBuildMinifyPlugin({
target: 'es2018', target: 'es2018',
}), }),
], ],
}, },
plugins: [ plugins: [
new ForkTsCheckerWebpackPlugin(), new ForkTsCheckerWebpackPlugin(),
new HtmlWebpackPlugin({ new HtmlWebpackPlugin({
@ -73,10 +71,14 @@ module.exports = (env) => {
devServer: { devServer: {
historyApiFallback: true, historyApiFallback: true,
host: '0.0.0.0', host: '0.0.0.0',
stats: 'errors-only',
overlay: true,
hot: true, hot: true,
client: {
overlay: true,
},
devMiddleware: {
stats: 'errors-only',
}
}, },
stats: 'minimal' stats: 'minimal'
} }
} }