Skip to content

Commit e348a46

Browse files
committed
refactor(@angular-devkit/build-angular): gate Ivy-only plugin behind feature flag
The new Ivy Webpack plugin is considered experimental and can only be used by enabling the `NG_BUILD_IVY_EXPERIMENTAL` environment variable.
1 parent 06e89c5 commit e348a46

File tree

2 files changed

+34
-9
lines changed

2 files changed

+34
-9
lines changed

.circleci/config.yml

+8
Original file line numberDiff line numberDiff line change
@@ -199,6 +199,14 @@ jobs:
199199
- run:
200200
name: Execute CLI E2E Tests
201201
command: PATH=~/.npm-global/bin:$PATH node ./tests/legacy-cli/run_e2e --nb-shards=${CIRCLE_NODE_TOTAL} --shard=${CIRCLE_NODE_INDEX} <<# parameters.ve >>--ve<</ parameters.ve >> <<# parameters.snapshots >>--ng-snapshots<</ parameters.snapshots >> --tmpdir=/mnt/ramdisk
202+
- unless:
203+
condition: << parameters.ve >>
204+
steps:
205+
- run:
206+
name: Execute CLI E2E Test Subset for Ivy-only plugin
207+
command: |
208+
rm -rf /mnt/ramdisk/*test-project
209+
PATH=~/.npm-global/bin:$PATH NG_BUILD_IVY_EXPERIMENTAL=1 node ./tests/legacy-cli/run_e2e --nb-shards=${CIRCLE_NODE_TOTAL} --shard=${CIRCLE_NODE_INDEX} <<# parameters.snapshots >>--ng-snapshots<</ parameters.snapshots >> --tmpdir=/mnt/ramdisk --glob="{tests/basic/**,tests/build/**}"
202210
203211
e2e-cli-node-10:
204212
executor:

packages/angular_devkit/build_angular/src/webpack/configs/typescript.ts

+26-9
Original file line numberDiff line numberDiff line change
@@ -26,31 +26,48 @@ function canUseIvyPlugin(wco: WebpackConfigOptions): boolean {
2626
return false;
2727
}
2828

29-
// Allow fallback to legacy build system via environment variable ('NG_BUILD_IVY_LEGACY=1')
30-
const flag = process.env['NG_BUILD_IVY_LEGACY'];
31-
if (flag !== undefined && flag !== '0' && flag.toLowerCase() !== 'false') {
32-
wco.logger.warn(
33-
'"NG_BUILD_IVY_LEGACY" environment variable detected. Using legacy Ivy build system.',
34-
);
35-
29+
// Allow new ivy build system via environment variable ('NG_BUILD_IVY_EXPERIMENTAL=1')
30+
// TODO: Remove this section and adjust warnings below once the Ivy plugin is the default
31+
const flag = process.env['NG_BUILD_IVY_EXPERIMENTAL'];
32+
if (flag === undefined || flag === '0' || flag.toLowerCase() === 'false') {
3633
return false;
3734
}
3835

36+
// Allow fallback to legacy build system via environment variable ('NG_BUILD_IVY_LEGACY=1')
37+
// TODO: Enable this section once the Ivy plugin is the default
38+
// const flag = process.env['NG_BUILD_IVY_LEGACY'];
39+
// if (flag !== undefined && flag !== '0' && flag.toLowerCase() !== 'false') {
40+
// wco.logger.warn(
41+
// '"NG_BUILD_IVY_LEGACY" environment variable detected. Using legacy Ivy build system.',
42+
// );
43+
44+
// return false;
45+
// }
46+
3947
// Lazy modules option uses the deprecated string format for lazy routes which is not supported
4048
if (wco.buildOptions.lazyModules && wco.buildOptions.lazyModules.length > 0) {
4149
wco.logger.warn(
42-
'"lazyModules" option is deprecated and not supported by the new Ivy build system. ' +
43-
'Using legacy Ivy build system.'
50+
'"lazyModules" option is deprecated and not supported by the experimental Ivy build system. ' +
51+
'Using existing Ivy build system.'
4452
);
4553

4654
return false;
4755
}
4856

4957
// This pass relies on internals of the original plugin
5058
if (wco.buildOptions.experimentalRollupPass) {
59+
wco.logger.warn(
60+
'The experimental rollup pass is not supported by the experimental Ivy build system. ' +
61+
'Using existing Ivy build system.'
62+
);
63+
5164
return false;
5265
}
5366

67+
wco.logger.warn(
68+
'"NG_BUILD_IVY_EXPERIMENTAL" environment variable detected. Using experimental Ivy build system.',
69+
);
70+
5471
return true;
5572
}
5673

0 commit comments

Comments
 (0)