File tree 4 files changed +13
-18
lines changed
packages/angular_devkit/build_angular/src/angular-cli-files
4 files changed +13
-18
lines changed Original file line number Diff line number Diff line change @@ -10,10 +10,6 @@ import { CommonJsUsageWarnPlugin } from '../../plugins/webpack';
10
10
import { WebpackConfigOptions } from '../build-options' ;
11
11
import { getSourceMapDevTool , isPolyfillsEntry , normalizeExtraEntryPoints } from './utils' ;
12
12
13
- const SubresourceIntegrityPlugin = require ( 'webpack-subresource-integrity' ) ;
14
- const LicenseWebpackPlugin = require ( 'license-webpack-plugin' ) . LicenseWebpackPlugin ;
15
-
16
-
17
13
export function getBrowserConfig ( wco : WebpackConfigOptions ) : webpack . Configuration {
18
14
const { buildOptions } = wco ;
19
15
const {
@@ -35,12 +31,14 @@ export function getBrowserConfig(wco: WebpackConfigOptions): webpack.Configurati
35
31
} = buildOptions . sourceMap ;
36
32
37
33
if ( subresourceIntegrity ) {
34
+ const SubresourceIntegrityPlugin = require ( 'webpack-subresource-integrity' ) ;
38
35
extraPlugins . push ( new SubresourceIntegrityPlugin ( {
39
36
hashFuncNames : [ 'sha384' ] ,
40
37
} ) ) ;
41
38
}
42
39
43
40
if ( extractLicenses ) {
41
+ const LicenseWebpackPlugin = require ( 'license-webpack-plugin' ) . LicenseWebpackPlugin ;
44
42
extraPlugins . push ( new LicenseWebpackPlugin ( {
45
43
stats : {
46
44
warnings : false ,
Original file line number Diff line number Diff line change @@ -47,8 +47,6 @@ import { findAllNodeModules } from '../../utilities/find-up';
47
47
import { WebpackConfigOptions } from '../build-options' ;
48
48
import { getEsVersionForFileName , getOutputHashFormat , normalizeExtraEntryPoints } from './utils' ;
49
49
50
- const ProgressPlugin = require ( 'webpack/lib/ProgressPlugin' ) ;
51
- const CircularDependencyPlugin = require ( 'circular-dependency-plugin' ) ;
52
50
const TerserPlugin = require ( 'terser-webpack-plugin' ) ;
53
51
const PnpWebpackPlugin = require ( 'pnp-webpack-plugin' ) ;
54
52
@@ -297,10 +295,12 @@ export function getCommonConfig(wco: WebpackConfigOptions): Configuration {
297
295
}
298
296
299
297
if ( buildOptions . progress ) {
298
+ const ProgressPlugin = require ( 'webpack/lib/ProgressPlugin' ) ;
300
299
extraPlugins . push ( new ProgressPlugin ( { profile : buildOptions . verbose } ) ) ;
301
300
}
302
301
303
302
if ( buildOptions . showCircularDependencies ) {
303
+ const CircularDependencyPlugin = require ( 'circular-dependency-plugin' ) ;
304
304
extraPlugins . push (
305
305
new CircularDependencyPlugin ( {
306
306
exclude : / ( [ \\ \/ ] n o d e _ m o d u l e s [ \\ \/ ] ) | ( n g f a c t o r y \. j s $ ) / ,
Original file line number Diff line number Diff line change @@ -10,9 +10,6 @@ import { Configuration } from 'webpack';
10
10
import { WebpackConfigOptions } from '../build-options' ;
11
11
import { getTypescriptWorkerPlugin } from './typescript' ;
12
12
13
- const WorkerPlugin = require ( 'worker-plugin' ) ;
14
-
15
-
16
13
export function getWorkerConfig ( wco : WebpackConfigOptions ) : Configuration {
17
14
const { buildOptions } = wco ;
18
15
@@ -25,6 +22,7 @@ export function getWorkerConfig(wco: WebpackConfigOptions): Configuration {
25
22
}
26
23
27
24
const workerTsConfigPath = resolve ( wco . root , buildOptions . webWorkerTsConfig ) ;
25
+ const WorkerPlugin = require ( 'worker-plugin' ) ;
28
26
29
27
return {
30
28
plugins : [ new WorkerPlugin ( {
Original file line number Diff line number Diff line change 5
5
* Use of this source code is governed by an MIT-style license that can be
6
6
* found in the LICENSE file at https://angular.io/license
7
7
*/
8
- import { Compiler } from 'webpack' ;
9
- // Webpack doesn't export these so the deep imports can potentially break.
10
- // There doesn't seem to exist any ergonomic way to alter chunk names for non-context lazy chunks
11
- // (https://github.com/webpack/webpack/issues/9075) so this is the best alternative for now.
12
- const ImportDependency = require ( 'webpack/lib/dependencies/ImportDependency' ) ;
13
- const ImportDependenciesBlock = require ( 'webpack/lib/dependencies/ImportDependenciesBlock' ) ;
14
- const Template = require ( 'webpack/lib/Template' ) ;
15
-
16
8
export class NamedLazyChunksPlugin {
17
9
constructor ( ) { }
18
- apply ( compiler : Compiler ) : void {
10
+ apply ( compiler : import ( 'webpack' ) . Compiler ) : void {
11
+ // Webpack doesn't export these so the deep imports can potentially break.
12
+ // There doesn't seem to exist any ergonomic way to alter chunk names for non-context lazy chunks
13
+ // (https://github.com/webpack/webpack/issues/9075) so this is the best alternative for now.
14
+ const ImportDependency = require ( 'webpack/lib/dependencies/ImportDependency' ) ;
15
+ const ImportDependenciesBlock = require ( 'webpack/lib/dependencies/ImportDependenciesBlock' ) ;
16
+ const Template = require ( 'webpack/lib/Template' ) ;
17
+
19
18
compiler . hooks . compilation . tap ( 'named-lazy-chunks-plugin' , compilation => {
20
19
// The dependencyReference hook isn't in the webpack typings so we have to type it as any.
21
20
// tslint:disable-next-line: no-any
You can’t perform that action at this time.
0 commit comments