File tree Expand file tree Collapse file tree 4 files changed +16
-5
lines changed
Expand file tree Collapse file tree 4 files changed +16
-5
lines changed Original file line number Diff line number Diff line change @@ -60,8 +60,9 @@ module.exports = {
6060 parallel (
6161 build_node_packages ,
6262 build_node_ts_packages ,
63- build_sw_packages ,
64- build_window_packages ,
63+ // This needs to be a series, not in parallel, so that there isn't a
64+ // race condition with the terser nameCache.
65+ series ( build_sw_packages , build_window_packages ) ,
6566 ) ,
6667 ) ,
6768} ;
Original file line number Diff line number Diff line change @@ -158,7 +158,9 @@ function swBundleSequence() {
158158
159159 return series (
160160 parallel ( transpilations ) ,
161- parallel ( builds ) ,
161+ // This needs to be a series, not in parallel, so that there isn't a
162+ // race condition with the terser nameCache.
163+ series ( builds ) ,
162164 ) ;
163165}
164166
Original file line number Diff line number Diff line change @@ -102,7 +102,9 @@ function windowBundleSequence() {
102102
103103 return series (
104104 parallel ( transpilations ) ,
105- parallel ( builds ) ,
105+ // This needs to be a series, not in parallel, so that there isn't a
106+ // race condition with the terser nameCache.
107+ series ( builds ) ,
106108 ) ;
107109}
108110
Original file line number Diff line number Diff line change @@ -15,6 +15,9 @@ const terserPlugin = require('rollup-plugin-terser').terser;
1515const constants = require ( './constants' ) ;
1616const getVersionsCDNUrl = require ( './versioned-cdn-url' ) ;
1717
18+ // See https://github.com/GoogleChrome/workbox/issues/1674
19+ const nameCache = { } ;
20+
1821module . exports = {
1922 // Every use of rollup should have minification and the replace
2023 // plugin set up and used to ensure as consist set of tests
@@ -46,6 +49,7 @@ module.exports = {
4649 const minifyBuild = buildType === constants . BUILD_TYPES . prod ;
4750 if ( minifyBuild ) {
4851 const terserOptions = {
52+ nameCache,
4953 module : buildFormat === 'esm' ? true : false ,
5054 mangle : {
5155 properties : {
@@ -54,8 +58,10 @@ module.exports = {
5458 '_obj' ,
5559 // We need this to be exported correctly.
5660 '_private' ,
61+ // See https://github.com/GoogleChrome/workbox/issues/2686
62+ '_handle' ,
5763 ] ,
58- // mangle > properties > regex will allow uglify-es to minify
64+ // mangle > properties > regex will allow terser to minify
5965 // private variable and names that start with a single underscore
6066 // followed by a letter. This restriction to avoid mangling
6167 // unintentional fields in our or other libraries code.
You can’t perform that action at this time.
0 commit comments