Update webpack config
This commit is contained in:
parent
7bf026a4f8
commit
97ee3c77a5
2 changed files with 4 additions and 17 deletions
|
|
@ -46,7 +46,6 @@
|
||||||
"sharp": "^0.29.3",
|
"sharp": "^0.29.3",
|
||||||
"string-replace-loader": "^3.1.0",
|
"string-replace-loader": "^3.1.0",
|
||||||
"svg-inline-loader": "^0.8.2",
|
"svg-inline-loader": "^0.8.2",
|
||||||
"terser-webpack-plugin": "^5.3.0",
|
|
||||||
"ts-loader": "^9.2.6",
|
"ts-loader": "^9.2.6",
|
||||||
"typescript": "^4.5.5",
|
"typescript": "^4.5.5",
|
||||||
"webpack": "^5.67.0",
|
"webpack": "^5.67.0",
|
||||||
|
|
|
||||||
|
|
@ -1,15 +1,11 @@
|
||||||
const path = require('path');
|
const path = require('path');
|
||||||
const HtmlWebpackPlugin = require('html-webpack-plugin');
|
const HtmlWebpackPlugin = require('html-webpack-plugin');
|
||||||
const TerserJSPlugin = require('terser-webpack-plugin');
|
|
||||||
const Sharp = require('responsive-loader/sharp');
|
const Sharp = require('responsive-loader/sharp');
|
||||||
const InlineSourceWebpackPlugin = require('inline-source-webpack-plugin');
|
const InlineSourceWebpackPlugin = require('inline-source-webpack-plugin');
|
||||||
const MiniCssExtractPlugin = require('mini-css-extract-plugin');
|
const MiniCssExtractPlugin = require('mini-css-extract-plugin');
|
||||||
const webpack = require('webpack');
|
const webpack = require('webpack');
|
||||||
|
|
||||||
module.exports = (env, argv) => ({
|
module.exports = (env, argv) => ({
|
||||||
watchOptions: {
|
|
||||||
ignored: /node_modules/,
|
|
||||||
},
|
|
||||||
devtool: argv.mode === 'development' ? 'inline-source-map' : false,
|
devtool: argv.mode === 'development' ? 'inline-source-map' : false,
|
||||||
entry: {
|
entry: {
|
||||||
index: './src/index.ts',
|
index: './src/index.ts',
|
||||||
|
|
@ -17,13 +13,6 @@ module.exports = (env, argv) => ({
|
||||||
devServer: {
|
devServer: {
|
||||||
hot: false,
|
hot: false,
|
||||||
},
|
},
|
||||||
optimization: {
|
|
||||||
minimizer: [
|
|
||||||
new TerserJSPlugin({
|
|
||||||
terserOptions: { sourceMap: argv.mode === 'development' },
|
|
||||||
}),
|
|
||||||
],
|
|
||||||
},
|
|
||||||
plugins: [
|
plugins: [
|
||||||
new HtmlWebpackPlugin({
|
new HtmlWebpackPlugin({
|
||||||
template: './src/index.html',
|
template: './src/index.html',
|
||||||
|
|
@ -111,19 +100,18 @@ module.exports = (env, argv) => ({
|
||||||
// for removing whitespace from template strings
|
// for removing whitespace from template strings
|
||||||
loader: 'string-replace-loader',
|
loader: 'string-replace-loader',
|
||||||
options: {
|
options: {
|
||||||
search: /`.*?`/gs,
|
search: /`\s+`/gs,
|
||||||
replace: (match) => match.replace(/\s+/g, ' '),
|
replace: ' ',
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
loader: 'string-replace-loader',
|
loader: 'string-replace-loader',
|
||||||
options: {
|
options: {
|
||||||
search: /`.*?`/gs,
|
search: /`>\s+<`/gs,
|
||||||
replace: (match) => match.replace(/>\s+</g, '><'),
|
replace: '><',
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
exclude: /node_modules/,
|
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue