Skip to content

Commit

Permalink
refactor(@ngtools/webpack): remove `suppressZoneJsIncompatibilityWarn…
Browse files Browse the repository at this point in the history
…ing` option

BREAKING CHANGE

`suppressZoneJsIncompatibilityWarning` option has been removed. If you are using this plugin directly and `async/await` in ES2017 make sure you downlevel the async syntax using Babel.

See: angular/zone.js#1140 for more information.
  • Loading branch information
alan-agius4 committed Mar 15, 2021
1 parent 0420f1a commit 6cc8c26
Show file tree
Hide file tree
Showing 5 changed files with 0 additions and 40 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,6 @@ function createIvyPlugin(
fileReplacements,
jitMode: !aot,
emitNgModuleScope: !optimize,
suppressZoneJsIncompatibilityWarning: true,
});
}

Expand Down Expand Up @@ -139,7 +138,6 @@ function _createAotPlugin(
directTemplateLoading: true,
...options,
compilerOptions,
suppressZoneJsIncompatibilityWarning: true,
};

pluginOptions = _pluginOptionsOverrides(buildOptions, pluginOptions);
Expand Down
3 changes: 0 additions & 3 deletions packages/ngtools/webpack/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,9 +63,6 @@ The loader works with webpack plugin to compile your TypeScript. It's important
* `i18nOutFile`. Optional and only used for View Engine compilations. The name of the file to write extractions to.
* `i18nOutFormat`. Optional and only used for View Engine compilations. The format of the localization file where extractions will be written to.
* `locale`. Optional and only used for View Engine compilations. Locale to use for i18n.
* `suppressZoneJsIncompatibilityWarning`. Optional, defaults to `false`. A Zone.js incompatibility warning is shown when the compilation target is ES2017+. Zone.js does not support native async/await in ES2017+. These blocks are not intercepted by zone.js and will not triggering change detection.
See https://github.com/angular/zone.js/pull/1140 for more information.

## Features
The benefits and ability of using [`@ngtools/webpack`](https://www.npmjs.com/~ngtools) standalone from the Angular CLI as presented in [Stephen Fluin's Angular CLI talk](https://youtu.be/uBRK6cTr4Vk?t=6m45s) at Angular Connect 2016:

Expand Down
12 changes: 0 additions & 12 deletions packages/ngtools/webpack/src/angular_compiler_plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -252,18 +252,6 @@ export class AngularCompilerPlugin {
this._platformTransformers = options.platformTransformers;
}

if (
!this.options.suppressZoneJsIncompatibilityWarning &&
this._compilerOptions.target !== undefined &&
this._compilerOptions.target >= ts.ScriptTarget.ES2017
) {
this._warnings.push(
'Zone.js does not support native async/await in ES2017+.\n' +
'These blocks are not intercepted by zone.js and will not triggering change detection.\n' +
'See: https://github.com/angular/zone.js/pull/1140 for more information.',
);
}

if (this._compilerOptions.strictMetadataEmit) {
this._warnings.push(
`Using Angular compiler option 'strictMetadataEmit' for applications might cause undefined behavior.`,
Expand Down
8 changes: 0 additions & 8 deletions packages/ngtools/webpack/src/interfaces.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,12 +55,4 @@ export interface AngularCompilerPluginOptions {

host?: virtualFs.Host<fs.Stats>;
platformTransformers?: ts.TransformerFactory<ts.SourceFile>[];

/**
* Suppress Zone.js incompatibility warning when using ES2017+.
* Zone.js does not support native async/await in ES2017+.
* These blocks are not intercepted by zone.js and will not triggering change detection.
* @see https://github.com/angular/zone.js/pull/1140
*/
suppressZoneJsIncompatibilityWarning?: boolean;
}
15 changes: 0 additions & 15 deletions packages/ngtools/webpack/src/ivy/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ export interface AngularPluginOptions {
directTemplateLoading: boolean;
emitClassMetadata: boolean;
emitNgModuleScope: boolean;
suppressZoneJsIncompatibilityWarning: boolean;
jitMode: boolean;
}

Expand Down Expand Up @@ -105,7 +104,6 @@ export class AngularWebpackPlugin {
substitutions: {},
directTemplateLoading: true,
tsconfig: 'tsconfig.json',
suppressZoneJsIncompatibilityWarning: false,
...options,
};
}
Expand Down Expand Up @@ -379,19 +377,6 @@ export class AngularWebpackPlugin {
compilerOptions.annotationsAs = 'decorators';
compilerOptions.enableResourceInlining = false;

if (
!this.pluginOptions.suppressZoneJsIncompatibilityWarning &&
compilerOptions.target &&
compilerOptions.target >= ts.ScriptTarget.ES2017
) {
addWarning(
compilation,
'Zone.js does not support native async/await in ES2017+.\n' +
'These blocks are not intercepted by zone.js and will not triggering change detection.\n' +
'See: https://github.com/angular/zone.js/pull/1140 for more information.',
);
}

return { compilerOptions, rootNames, errors };
}

Expand Down

0 comments on commit 6cc8c26

Please sign in to comment.