Update webpack config

This commit is contained in:
Andras Schmelczer 2022-09-20 14:06:38 +02:00
parent 7bf026a4f8
commit 97ee3c77a5
No known key found for this signature in database
GPG key ID: 0EA1BC97D0AB076E
2 changed files with 4 additions and 17 deletions

View file

@ -1,15 +1,11 @@
const path = require('path');
const HtmlWebpackPlugin = require('html-webpack-plugin');
const TerserJSPlugin = require('terser-webpack-plugin');
const Sharp = require('responsive-loader/sharp');
const InlineSourceWebpackPlugin = require('inline-source-webpack-plugin');
const MiniCssExtractPlugin = require('mini-css-extract-plugin');
const webpack = require('webpack');
module.exports = (env, argv) => ({
watchOptions: {
ignored: /node_modules/,
},
devtool: argv.mode === 'development' ? 'inline-source-map' : false,
entry: {
index: './src/index.ts',
@ -17,13 +13,6 @@ module.exports = (env, argv) => ({
devServer: {
hot: false,
},
optimization: {
minimizer: [
new TerserJSPlugin({
terserOptions: { sourceMap: argv.mode === 'development' },
}),
],
},
plugins: [
new HtmlWebpackPlugin({
template: './src/index.html',
@ -111,19 +100,18 @@ module.exports = (env, argv) => ({
// for removing whitespace from template strings
loader: 'string-replace-loader',
options: {
search: /`.*?`/gs,
replace: (match) => match.replace(/\s+/g, ' '),
search: /`\s+`/gs,
replace: ' ',
},
},
{
loader: 'string-replace-loader',
options: {
search: /`.*?`/gs,
replace: (match) => match.replace(/>\s+</g, '><'),
search: /`>\s+<`/gs,
replace: '><',
},
},
],
exclude: /node_modules/,
},
],
},