File tree 4 files changed +18
-5
lines changed
angular_devkit/build_angular
src/angular-cli-files/models
4 files changed +18
-5
lines changed Original file line number Diff line number Diff line change 752
752
"description" : " Generates a service worker config for production builds." ,
753
753
"default" : false
754
754
},
755
+ "autoBundleWorkerModules" : {
756
+ "type" : " boolean" ,
757
+ "description" : " Automatically bundle new Worker('..', { type:'module' })" ,
758
+ "default" : true
759
+ },
755
760
"skipAppShell" : {
756
761
"type" : " boolean" ,
757
762
"description" : " Flag to prevent building an app shell." ,
Original file line number Diff line number Diff line change 27
27
"loader-utils" : " 1.1.0" ,
28
28
"mini-css-extract-plugin" : " 0.4.3" ,
29
29
"minimatch" : " 3.0.4" ,
30
- "parse5" : " 4.0.0" ,
31
30
"opn" : " 5.3.0" ,
31
+ "parse5" : " 4.0.0" ,
32
32
"portfinder" : " 1.0.17" ,
33
33
"postcss" : " 6.0.23" ,
34
34
"postcss-import" : " 11.1.0" ,
37
37
"rxjs" : " 6.3.3" ,
38
38
"sass-loader" : " 7.1.0" ,
39
39
"semver" : " 5.5.1" ,
40
- "source-map-support" : " 0.5.9" ,
41
40
"source-map-loader" : " 0.2.4" ,
41
+ "source-map-support" : " 0.5.9" ,
42
42
"speed-measure-webpack-plugin" : " ^1.2.3" ,
43
43
"stats-webpack-plugin" : " 0.7.0" ,
44
44
"style-loader" : " 0.23.0" ,
45
45
"stylus" : " 0.54.5" ,
46
46
"stylus-loader" : " 3.0.2" ,
47
- "tree-kill" : " 1.2.0" ,
48
47
"terser-webpack-plugin" : " 1.1.0" ,
48
+ "tree-kill" : " 1.2.0" ,
49
49
"webpack" : " 4.19.1" ,
50
50
"webpack-dev-middleware" : " 3.3.0" ,
51
51
"webpack-dev-server" : " 3.1.8" ,
52
52
"webpack-merge" : " 4.1.4" ,
53
53
"webpack-sources" : " 1.2.0" ,
54
- "webpack-subresource-integrity" : " 1.1.0-rc.6"
54
+ "webpack-subresource-integrity" : " 1.1.0-rc.6" ,
55
+ "worker-plugin" : " ^1.1.1"
55
56
},
56
57
"optionalDependencies" : {
57
58
"node-sass" : " 4.9.3"
87
88
"protractor" : " ~5.4.0" ,
88
89
"zone.js" : " ^0.8.19"
89
90
}
90
- }
91
+ }
Original file line number Diff line number Diff line change @@ -49,6 +49,7 @@ export interface BuildOptions {
49
49
namedChunks ?: boolean ;
50
50
subresourceIntegrity ?: boolean ;
51
51
serviceWorker ?: boolean ;
52
+ autoBundleWorkerModules ?: boolean ;
52
53
skipAppShell ?: boolean ;
53
54
statsJson : boolean ;
54
55
forkTypeChecker : boolean ;
Original file line number Diff line number Diff line change 11
11
import * as path from 'path' ;
12
12
import { HashedModuleIdsPlugin , debug } from 'webpack' ;
13
13
import * as CopyWebpackPlugin from 'copy-webpack-plugin' ;
14
+ import * as WorkerPlugin from 'worker-plugin' ;
14
15
import { getOutputHashFormat } from './utils' ;
15
16
import { isDirectory } from '../../utilities/is-directory' ;
16
17
import { requireProjectModule } from '../../utilities/require-project-module' ;
@@ -120,6 +121,11 @@ export function getCommonConfig(wco: WebpackConfigOptions) {
120
121
} ) ;
121
122
}
122
123
124
+ if ( buildOptions . autoBundleWorkerModules ) {
125
+ const workerPluginInstance = new WorkerPlugin ( ) ;
126
+ extraPlugins . push ( workerPluginInstance ) ;
127
+ }
128
+
123
129
// process asset entries
124
130
if ( buildOptions . assets ) {
125
131
const copyWebpackPluginPatterns = buildOptions . assets . map ( ( asset : AssetPatternObject ) => {
You can’t perform that action at this time.
0 commit comments