webpack: 최적화 옵션 변경
This commit is contained in:
@@ -47,6 +47,7 @@
|
|||||||
"@babel/core": "^7.15.0",
|
"@babel/core": "^7.15.0",
|
||||||
"@babel/preset-env": "^7.15.0",
|
"@babel/preset-env": "^7.15.0",
|
||||||
"@babel/preset-typescript": "^7.15.0",
|
"@babel/preset-typescript": "^7.15.0",
|
||||||
|
"@swc/core": "^1.2.84",
|
||||||
"@types/bootstrap": "^5.1.2",
|
"@types/bootstrap": "^5.1.2",
|
||||||
"@types/jquery": "^3.5.6",
|
"@types/jquery": "^3.5.6",
|
||||||
"@types/lodash": "^4.14.172",
|
"@types/lodash": "^4.14.172",
|
||||||
|
|||||||
+31
-19
@@ -5,7 +5,7 @@ const CssMinimizerPlugin = require('css-minimizer-webpack-plugin');
|
|||||||
const BundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPlugin;
|
const BundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPlugin;
|
||||||
const { resolve } = require('path');
|
const { resolve } = require('path');
|
||||||
const CleanTerminalPlugin = require('clean-terminal-webpack-plugin');
|
const CleanTerminalPlugin = require('clean-terminal-webpack-plugin');
|
||||||
|
const TerserPlugin = require('terser-webpack-plugin');
|
||||||
module.exports = (env, argv) => {
|
module.exports = (env, argv) => {
|
||||||
const target = env.target ?? 'hwe';
|
const target = env.target ?? 'hwe';
|
||||||
const mode = argv.mode ?? 'production';
|
const mode = argv.mode ?? 'production';
|
||||||
@@ -51,6 +51,16 @@ module.exports = (env, argv) => {
|
|||||||
},
|
},
|
||||||
minimizer: [
|
minimizer: [
|
||||||
new CssMinimizerPlugin(),
|
new CssMinimizerPlugin(),
|
||||||
|
new TerserPlugin({
|
||||||
|
terserOptions: {
|
||||||
|
format: {
|
||||||
|
comments: /@license/i,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
minify: TerserPlugin.swcMinify,
|
||||||
|
parallel: true,
|
||||||
|
extractComments: true,
|
||||||
|
}),
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
module: {
|
module: {
|
||||||
@@ -96,17 +106,11 @@ module.exports = (env, argv) => {
|
|||||||
test: /\.(png|jpe?g|gif|webp)$/,
|
test: /\.(png|jpe?g|gif|webp)$/,
|
||||||
use: [
|
use: [
|
||||||
{
|
{
|
||||||
loader: 'url-loader',
|
|
||||||
options: {
|
|
||||||
limit: 4096,
|
|
||||||
fallback: {
|
|
||||||
loader: 'file-loader',
|
loader: 'file-loader',
|
||||||
options: {
|
options: {
|
||||||
name: '../dist_misc/[name].[contenthash:8].[ext]'
|
name: '../dist_misc/[name].[contenthash:8].[ext]'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -124,34 +128,22 @@ module.exports = (env, argv) => {
|
|||||||
test: /\.(mp4|webm|ogg|mp3|wav|flac|aac)$/,
|
test: /\.(mp4|webm|ogg|mp3|wav|flac|aac)$/,
|
||||||
use: [
|
use: [
|
||||||
{
|
{
|
||||||
loader: 'url-loader',
|
|
||||||
options: {
|
|
||||||
limit: 4096,
|
|
||||||
fallback: {
|
|
||||||
loader: 'file-loader',
|
loader: 'file-loader',
|
||||||
options: {
|
options: {
|
||||||
name: '../dist_misc/[name].[contenthash:8].[ext]'
|
name: '../dist_misc/[name].[contenthash:8].[ext]'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
test: /\.(woff2?|eot|ttf|otf)$/i,
|
test: /\.(woff2?|eot|ttf|otf)$/i,
|
||||||
use: [
|
use: [
|
||||||
{
|
{
|
||||||
loader: 'url-loader',
|
|
||||||
options: {
|
|
||||||
limit: 4096,
|
|
||||||
fallback: {
|
|
||||||
loader: 'file-loader',
|
loader: 'file-loader',
|
||||||
options: {
|
options: {
|
||||||
name: '../dist_misc/[name].[contenthash:8].[ext]'
|
name: '../dist_misc/[name].[contenthash:8].[ext]'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
]
|
]
|
||||||
@@ -217,6 +209,16 @@ module.exports = (env, argv) => {
|
|||||||
},
|
},
|
||||||
minimizer: [
|
minimizer: [
|
||||||
new CssMinimizerPlugin(),
|
new CssMinimizerPlugin(),
|
||||||
|
new TerserPlugin({
|
||||||
|
terserOptions: {
|
||||||
|
format: {
|
||||||
|
comments: /@license/i,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
minify: TerserPlugin.swcMinify,
|
||||||
|
parallel: true,
|
||||||
|
extractComments: true,
|
||||||
|
}),
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
module: {
|
module: {
|
||||||
@@ -287,6 +289,16 @@ module.exports = (env, argv) => {
|
|||||||
},
|
},
|
||||||
minimizer: [
|
minimizer: [
|
||||||
new CssMinimizerPlugin(),
|
new CssMinimizerPlugin(),
|
||||||
|
new TerserPlugin({
|
||||||
|
terserOptions: {
|
||||||
|
format: {
|
||||||
|
comments: /@license/i,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
minify: TerserPlugin.swcMinify,
|
||||||
|
parallel: true,
|
||||||
|
extractComments: true,
|
||||||
|
}),
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
module: {
|
module: {
|
||||||
|
|||||||
Reference in New Issue
Block a user