Update webpack config
This commit is contained in:
parent
7bf026a4f8
commit
97ee3c77a5
2 changed files with 4 additions and 17 deletions
|
|
@ -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/,
|
||||
},
|
||||
],
|
||||
},
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue