mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-11 08:33:53 +00:00
hotfix: use terser-webpack-plugin
(#3928)
<!--- Provide a general summary of your changes in the title above --> ## Types of changes <!--- What types of changes does your code introduce? Put an `x` in all the boxes that apply: --> - [ ] Bug fix (non-breaking change which fixes an issue) - [ ] New feature (non-breaking change which adds functionality) - [ ] Breaking change (fix or feature that would cause existing functionality to change) ## Description Webpack requires `uglifyjs-webpack-plugin@1.x`. thus `uglifyjs-webpack-plugin@2.x` may not resolve correctly. Also, the webpack team decided to go with `terser-webpack-plugin` (https://github.com/webpack/webpack/pull/8036). ## Checklist: <!--- Put an `x` in all the boxes that apply. --> <!--- If your change requires a documentation PR, please link it appropriately --> <!--- If you're unsure about any of these, don't hesitate to ask. We're here to help! --> - [ ] My change requires a change to the documentation. - [ ] I have updated the documentation accordingly. (PR: #) - [ ] I have added tests to cover my changes (if not applicable, please state why) - [ ] All new and existing tests passed.
This commit is contained in:
parent
e4d7bc7018
commit
b69cabef88
@ -3,7 +3,7 @@ import path from 'path'
|
||||
import webpack from 'webpack'
|
||||
import HTMLPlugin from 'html-webpack-plugin'
|
||||
import BundleAnalyzer from 'webpack-bundle-analyzer'
|
||||
import UglifyJsWebpackPlugin from 'uglifyjs-webpack-plugin'
|
||||
import TerserWebpackPlugin from 'terser-webpack-plugin'
|
||||
import OptimizeCSSAssetsPlugin from 'optimize-css-assets-webpack-plugin'
|
||||
import FriendlyErrorsWebpackPlugin from '@nuxtjs/friendly-errors-webpack-plugin'
|
||||
|
||||
@ -102,21 +102,21 @@ export default class WebpackClientConfig extends WebpackBaseConfig {
|
||||
if (!this.options.dev && !config.optimization.minimizer) {
|
||||
config.optimization.minimizer = []
|
||||
|
||||
// https://github.com/webpack-contrib/uglifyjs-webpack-plugin
|
||||
const uglifyJsPlugin = new UglifyJsWebpackPlugin({
|
||||
// https://github.com/webpack-contrib/terser-webpack-plugin
|
||||
const terserJsPlugin = new TerserWebpackPlugin({
|
||||
parallel: true,
|
||||
cache: this.options.build.cache,
|
||||
sourceMap: config.devtool && /source-?map/.test(config.devtool),
|
||||
extractComments: {
|
||||
filename: 'LICENSES'
|
||||
},
|
||||
uglifyOptions: {
|
||||
terserOptions: {
|
||||
output: {
|
||||
comments: /^\**!|@preserve|@license|@cc_on/
|
||||
}
|
||||
}
|
||||
})
|
||||
config.optimization.minimizer.push(uglifyJsPlugin)
|
||||
config.optimization.minimizer.push(terserJsPlugin)
|
||||
|
||||
// https://github.com/NMFR/optimize-css-assets-webpack-plugin
|
||||
// https://github.com/webpack-contrib/mini-css-extract-plugin#minimizing-for-production
|
||||
|
@ -110,9 +110,9 @@
|
||||
"server-destroy": "^1.0.1",
|
||||
"std-env": "^1.3.1",
|
||||
"style-resources-loader": "^1.2.1",
|
||||
"terser-webpack-plugin": "^1.1.0",
|
||||
"thread-loader": "^1.2.0",
|
||||
"time-fix-plugin": "^2.0.3",
|
||||
"uglifyjs-webpack-plugin": "^2.0.1",
|
||||
"upath": "^1.1.0",
|
||||
"url-loader": "^1.1.1",
|
||||
"vue": "^2.5.17",
|
||||
|
@ -96,9 +96,9 @@
|
||||
"server-destroy": "^1.0.1",
|
||||
"std-env": "^1.3.1",
|
||||
"style-resources-loader": "^1.2.1",
|
||||
"terser-webpack-plugin": "^1.1.0",
|
||||
"thread-loader": "^1.2.0",
|
||||
"time-fix-plugin": "^2.0.3",
|
||||
"uglifyjs-webpack-plugin": "^2.0.1",
|
||||
"upath": "^1.1.0",
|
||||
"url-loader": "^1.1.1",
|
||||
"vue": "^2.5.17",
|
||||
|
40
yarn.lock
40
yarn.lock
@ -1622,7 +1622,7 @@ cacache@^10.0.4:
|
||||
unique-filename "^1.1.0"
|
||||
y18n "^4.0.0"
|
||||
|
||||
cacache@^11.2.0:
|
||||
cacache@^11.0.2:
|
||||
version "11.2.0"
|
||||
resolved "https://registry.npmjs.org/cacache/-/cacache-11.2.0.tgz#617bdc0b02844af56310e411c0878941d5739965"
|
||||
dependencies:
|
||||
@ -7102,7 +7102,7 @@ source-map-support@^0.4.15:
|
||||
dependencies:
|
||||
source-map "^0.5.6"
|
||||
|
||||
source-map-support@^0.5.6:
|
||||
source-map-support@^0.5.6, source-map-support@~0.5.6:
|
||||
version "0.5.9"
|
||||
resolved "https://registry.npmjs.org/source-map-support/-/source-map-support-0.5.9.tgz#41bc953b2534267ea2d605bccfa7bfa3111ced5f"
|
||||
dependencies:
|
||||
@ -7411,6 +7411,27 @@ tar@^4:
|
||||
safe-buffer "^5.1.2"
|
||||
yallist "^3.0.2"
|
||||
|
||||
terser-webpack-plugin@^1.1.0:
|
||||
version "1.1.0"
|
||||
resolved "https://registry.npmjs.org/terser-webpack-plugin/-/terser-webpack-plugin-1.1.0.tgz#cf7c25a1eee25bf121f4a587bb9e004e3f80e528"
|
||||
dependencies:
|
||||
cacache "^11.0.2"
|
||||
find-cache-dir "^2.0.0"
|
||||
schema-utils "^1.0.0"
|
||||
serialize-javascript "^1.4.0"
|
||||
source-map "^0.6.1"
|
||||
terser "^3.8.1"
|
||||
webpack-sources "^1.1.0"
|
||||
worker-farm "^1.5.2"
|
||||
|
||||
terser@^3.8.1:
|
||||
version "3.8.2"
|
||||
resolved "https://registry.npmjs.org/terser/-/terser-3.8.2.tgz#48b880f949f8d038aca4dfd00a37c53d96ecf9fb"
|
||||
dependencies:
|
||||
commander "~2.17.1"
|
||||
source-map "~0.6.1"
|
||||
source-map-support "~0.5.6"
|
||||
|
||||
test-exclude@^4.2.1:
|
||||
version "4.2.3"
|
||||
resolved "https://registry.npmjs.org/test-exclude/-/test-exclude-4.2.3.tgz#a9a5e64474e4398339245a0a769ad7c2f4a97c20"
|
||||
@ -7577,7 +7598,7 @@ uglify-es@^3.3.4:
|
||||
commander "~2.13.0"
|
||||
source-map "~0.6.1"
|
||||
|
||||
uglify-js@3.4.x, uglify-js@^3.0.0, uglify-js@^3.1.4:
|
||||
uglify-js@3.4.x, uglify-js@^3.1.4:
|
||||
version "3.4.9"
|
||||
resolved "https://registry.npmjs.org/uglify-js/-/uglify-js-3.4.9.tgz#af02f180c1207d76432e473ed24a28f4a782bae3"
|
||||
dependencies:
|
||||
@ -7610,19 +7631,6 @@ uglifyjs-webpack-plugin@^1.2.4:
|
||||
webpack-sources "^1.1.0"
|
||||
worker-farm "^1.5.2"
|
||||
|
||||
uglifyjs-webpack-plugin@^2.0.1:
|
||||
version "2.0.1"
|
||||
resolved "https://registry.npmjs.org/uglifyjs-webpack-plugin/-/uglifyjs-webpack-plugin-2.0.1.tgz#f346af53ed496ce72fef462517d417f62bec3010"
|
||||
dependencies:
|
||||
cacache "^11.2.0"
|
||||
find-cache-dir "^2.0.0"
|
||||
schema-utils "^1.0.0"
|
||||
serialize-javascript "^1.4.0"
|
||||
source-map "^0.6.1"
|
||||
uglify-js "^3.0.0"
|
||||
webpack-sources "^1.1.0"
|
||||
worker-farm "^1.5.2"
|
||||
|
||||
unicode-canonical-property-names-ecmascript@^1.0.4:
|
||||
version "1.0.4"
|
||||
resolved "https://registry.npmjs.org/unicode-canonical-property-names-ecmascript/-/unicode-canonical-property-names-ecmascript-1.0.4.tgz#2619800c4c825800efdd8343af7dd9933cbe2818"
|
||||
|
Loading…
Reference in New Issue
Block a user