From 794f766db8f471fa6232c3b95fa6e2310c511bfa Mon Sep 17 00:00:00 2001 From: hide_d Date: Wed, 8 Sep 2021 03:29:43 +0900 Subject: [PATCH] =?UTF-8?q?webpack:=20=EC=B5=9C=EC=A0=81=ED=99=94=20?= =?UTF-8?q?=EC=98=B5=EC=85=98=20=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- package.json | 1 + webpack.config.cjs | 62 +++++++++++++++++++++++++++------------------- 2 files changed, 38 insertions(+), 25 deletions(-) diff --git a/package.json b/package.json index 8ca4091f..8661164d 100644 --- a/package.json +++ b/package.json @@ -47,6 +47,7 @@ "@babel/core": "^7.15.0", "@babel/preset-env": "^7.15.0", "@babel/preset-typescript": "^7.15.0", + "@swc/core": "^1.2.84", "@types/bootstrap": "^5.1.2", "@types/jquery": "^3.5.6", "@types/lodash": "^4.14.172", diff --git a/webpack.config.cjs b/webpack.config.cjs index c405f0fc..737aa771 100644 --- a/webpack.config.cjs +++ b/webpack.config.cjs @@ -5,7 +5,7 @@ const CssMinimizerPlugin = require('css-minimizer-webpack-plugin'); const BundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPlugin; const { resolve } = require('path'); const CleanTerminalPlugin = require('clean-terminal-webpack-plugin'); - +const TerserPlugin = require('terser-webpack-plugin'); module.exports = (env, argv) => { const target = env.target ?? 'hwe'; const mode = argv.mode ?? 'production'; @@ -51,6 +51,16 @@ module.exports = (env, argv) => { }, minimizer: [ new CssMinimizerPlugin(), + new TerserPlugin({ + terserOptions: { + format: { + comments: /@license/i, + }, + }, + minify: TerserPlugin.swcMinify, + parallel: true, + extractComments: true, + }), ], }, module: { @@ -96,15 +106,9 @@ module.exports = (env, argv) => { test: /\.(png|jpe?g|gif|webp)$/, use: [ { - loader: 'url-loader', + loader: 'file-loader', options: { - limit: 4096, - fallback: { - loader: 'file-loader', - options: { - name: '../dist_misc/[name].[contenthash:8].[ext]' - } - } + name: '../dist_misc/[name].[contenthash:8].[ext]' } } ] @@ -124,15 +128,9 @@ module.exports = (env, argv) => { test: /\.(mp4|webm|ogg|mp3|wav|flac|aac)$/, use: [ { - loader: 'url-loader', + loader: 'file-loader', options: { - limit: 4096, - fallback: { - loader: 'file-loader', - options: { - name: '../dist_misc/[name].[contenthash:8].[ext]' - } - } + name: '../dist_misc/[name].[contenthash:8].[ext]' } } ] @@ -141,15 +139,9 @@ module.exports = (env, argv) => { test: /\.(woff2?|eot|ttf|otf)$/i, use: [ { - loader: 'url-loader', + loader: 'file-loader', options: { - limit: 4096, - fallback: { - loader: 'file-loader', - options: { - name: '../dist_misc/[name].[contenthash:8].[ext]' - } - } + name: '../dist_misc/[name].[contenthash:8].[ext]' } } ] @@ -217,6 +209,16 @@ module.exports = (env, argv) => { }, minimizer: [ new CssMinimizerPlugin(), + new TerserPlugin({ + terserOptions: { + format: { + comments: /@license/i, + }, + }, + minify: TerserPlugin.swcMinify, + parallel: true, + extractComments: true, + }), ], }, module: { @@ -287,6 +289,16 @@ module.exports = (env, argv) => { }, minimizer: [ new CssMinimizerPlugin(), + new TerserPlugin({ + terserOptions: { + format: { + comments: /@license/i, + }, + }, + minify: TerserPlugin.swcMinify, + parallel: true, + extractComments: true, + }), ], }, module: {