Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

build: update terser-webpack-plugin to version 5 #20824

Merged
merged 1 commit into from May 17, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion package.json
Expand Up @@ -219,7 +219,7 @@
"tar": "^6.0.0",
"temp": "^0.9.0",
"terser": "5.7.0",
"terser-webpack-plugin": "4.2.3",
"terser-webpack-plugin": "5.1.2",
"text-table": "0.2.0",
"through2": "^4.0.0",
"tree-kill": "1.2.2",
Expand Down
2 changes: 1 addition & 1 deletion packages/angular_devkit/build_angular/package.json
Expand Up @@ -65,7 +65,7 @@
"stylus": "0.54.8",
"stylus-loader": "6.0.0",
"terser": "5.7.0",
"terser-webpack-plugin": "4.2.3",
"terser-webpack-plugin": "5.1.2",
"text-table": "0.2.0",
"tree-kill": "1.2.2",
"webpack": "5.37.0",
Expand Down
Expand Up @@ -61,6 +61,7 @@ export function getCommonConfig(wco: WebpackConfigOptions): Configuration {

// determine hashing format
const hashFormat = getOutputHashFormat(buildOptions.outputHashing || 'none');
const buildBrowserFeatures = new BuildBrowserFeatures(projectRoot);

const targetInFileName = getEsVersionForFileName(
tsConfig.options.target,
Expand All @@ -75,8 +76,6 @@ export function getCommonConfig(wco: WebpackConfigOptions): Configuration {
const differentialLoadingMode = buildOptions.differentialLoadingNeeded && !buildOptions.watch;
if (platform !== 'server') {
if (differentialLoadingMode || tsConfig.options.target === ScriptTarget.ES5) {
const buildBrowserFeatures = new BuildBrowserFeatures(projectRoot);

if (buildBrowserFeatures.isEs5SupportNeeded()) {
const polyfillsChunkName = 'polyfills-es5';
entryPoints[polyfillsChunkName] = [path.join(__dirname, '..', 'es5-polyfills.js')];
Expand Down Expand Up @@ -391,21 +390,18 @@ export function getCommonConfig(wco: WebpackConfigOptions): Configuration {
};

const globalScriptsNames = globalScriptsByBundleName.map((s) => s.bundleName);

extraMinimizers.push(
new TerserPlugin({
sourceMap: scriptsSourceMap,
parallel: maxWorkers,
cache: !cachingDisabled && findCachePath('terser-webpack'),
extractComments: false,
exclude: globalScriptsNames,
terserOptions,
}),
// Script bundles are fully optimized here in one step since they are never downleveled.
// They are shared between ES2015 & ES5 outputs so must support ES5.
new TerserPlugin({
sourceMap: scriptsSourceMap,
parallel: maxWorkers,
cache: !cachingDisabled && findCachePath('terser-webpack'),
extractComments: false,
include: globalScriptsNames,
terserOptions: {
Expand Down
23 changes: 4 additions & 19 deletions yarn.lock
Expand Up @@ -6622,7 +6622,7 @@ jasminewd2@^2.1.0:
resolved "https://registry.yarnpkg.com/jasminewd2/-/jasminewd2-2.2.0.tgz#e37cf0b17f199cce23bea71b2039395246b4ec4e"
integrity sha1-43zwsX8ZnM4jvqcbIDk5Uka07E4=

jest-worker@26.6.2, jest-worker@^26.3.0, jest-worker@^26.5.0, jest-worker@^26.6.2:
jest-worker@26.6.2, jest-worker@^26.3.0, jest-worker@^26.6.2:
version "26.6.2"
resolved "https://registry.yarnpkg.com/jest-worker/-/jest-worker-26.6.2.tgz#7f72cbc4d643c365e27b9fd775f9d0eaa9c7a8ed"
integrity sha512-KWYVV1c4i+jbMpaBC+U++4Va0cp8OisU185o73T1vo99hqi7w8tSJfUXYswwqqrjzwxa6KpRK54WhPvwf5w6PQ==
Expand Down Expand Up @@ -11144,22 +11144,7 @@ temp@^0.9.0:
mkdirp "^0.5.1"
rimraf "~2.6.2"

terser-webpack-plugin@4.2.3:
version "4.2.3"
resolved "https://registry.yarnpkg.com/terser-webpack-plugin/-/terser-webpack-plugin-4.2.3.tgz#28daef4a83bd17c1db0297070adc07fc8cfc6a9a"
integrity sha512-jTgXh40RnvOrLQNgIkwEKnQ8rmHjHK4u+6UBEi+W+FPmvb+uo+chJXntKe7/3lW5mNysgSWD60KyesnhW8D6MQ==
dependencies:
cacache "^15.0.5"
find-cache-dir "^3.3.1"
jest-worker "^26.5.0"
p-limit "^3.0.2"
schema-utils "^3.0.0"
serialize-javascript "^5.0.1"
source-map "^0.6.1"
terser "^5.3.4"
webpack-sources "^1.4.3"

terser-webpack-plugin@^5.1.1:
terser-webpack-plugin@5.1.2, terser-webpack-plugin@^5.1.1:
version "5.1.2"
resolved "https://registry.yarnpkg.com/terser-webpack-plugin/-/terser-webpack-plugin-5.1.2.tgz#51d295eb7cc56785a67a372575fdc46e42d5c20c"
integrity sha512-6QhDaAiVHIQr5Ab3XUWZyDmrIPCHMiqJVljMF91YKyqwKkL5QHnYMkrMBy96v9Z7ev1hGhSEw1HQZc2p/s5Z8Q==
Expand All @@ -11171,7 +11156,7 @@ terser-webpack-plugin@^5.1.1:
source-map "^0.6.1"
terser "^5.7.0"

terser@5.7.0, terser@^5.3.4, terser@^5.7.0:
terser@5.7.0, terser@^5.7.0:
version "5.7.0"
resolved "https://registry.yarnpkg.com/terser/-/terser-5.7.0.tgz#a761eeec206bc87b605ab13029876ead938ae693"
integrity sha512-HP5/9hp2UaZt5fYkuhNBR8YyRcT8juw8+uFbAme53iN9hblvKnLUTKkmwJG6ocWpIKf8UK4DoeWG4ty0J6S6/g==
Expand Down Expand Up @@ -12029,7 +12014,7 @@ webpack-merge@5.7.3:
clone-deep "^4.0.1"
wildcard "^2.0.0"

webpack-sources@^1.1.0, webpack-sources@^1.2.0, webpack-sources@^1.3.0, webpack-sources@^1.4.3:
webpack-sources@^1.1.0, webpack-sources@^1.2.0, webpack-sources@^1.3.0:
version "1.4.3"
resolved "https://registry.yarnpkg.com/webpack-sources/-/webpack-sources-1.4.3.tgz#eedd8ec0b928fbf1cbfe994e22d2d890f330a933"
integrity sha512-lgTS3Xhv1lCOKo7SA5TjKXMjpSM4sBjNV5+q2bqesbSPs5FjGmU6jjtBSkX9b4qW87vDIsCIlUPOEhbZrMdjeQ==
Expand Down