Webpack 5 supports setting a module's alias to `false` to signify that a module should be ignored. This option removes the need for the `empty.js` file as an alias option value.
The workaround code was gated on the presence of Node.js 10 but the CLI no longer supports Node.js 10 and will execute with an error if attempted. As a result, the workaround code would never be executed.
BREAKING CHANGE:
With this change we removed several deprecated builder options
- `extractCss` has been removed from the browser builder. CSS is now always extracted.
- `servePathDefaultWarning` and `hmrWarning` have been removed from the dev-server builder. These options had no effect.
BREAKING CHANGE:
The automatic inclusion of Angular-required ES2015 polyfills to support ES5 browsers has been removed. Previously when targetting ES5 within the application's TypeScript configuration or listing an ES5 requiring browser in the browserslist file, Angular-required polyfills were included in the built application. However, with Angular no longer supporting IE11, there are now no browsers officially supported by Angular that would require these polyfills. As a result, the automatic inclusion of these ES2015 polyfills has been removed. Any polyfills manually added to an application's code are not affected by this change.
BREAKING CHANGE:
Differential loading support has been removed. With Angular no longer supporting IE11, there are now no browsers officially supported by Angular that require ES5 code. As a result, differential loading's functionality for creating and conditionally loading ES5 and ES2015+ variants of an application is no longer required.
With this change we emit the compilation result when the compilation is closed, when the compilation is not in watch mode.
This is needed so that when persistent caching is enabled and architect promise API is used (`.result`) instead of `.output` we wait for the cache to be written prior to terminating the process/resolving the result promise.
The `result` API currently, takes the first emit 4f9df9f4a4/packages/angular_devkit/architect/src/schedule-by-name.ts (L118-L120)Closes#21419
The dev-infra tooling now directly provides public API change testing capabilities that leverage the `api-extractor` utility. These new testing capabilities are shared with framework and components.
`ts-api-guardian` has been removed as a dependency as a result.
When script optimizations are enabled, classes containing downlevelled static properties are wrapped in a pure annotated IIFE to allow the class to be removed if it is otherwise unused. Only properties with initializer values that do not have the potential for side effects can be safely wrapped. Previously, pure annotations were not considered when analyzing the values and this caused classes to be retained that could be considered safe for removal. To resolve this issue, pure annotations are now considered when analyzing a property's initializer value for potential side effects.
Limiting the terser passes to two helps to workaround an issue with terser wherein terser will errantly inline a function argument containing a `yield` expression inside an inner arrow function. This results in a syntax error since the yield expression is no longer within the scope of a generator.
The stylesheet optimization pipeline now uses `esbuild` for component stylesheets. The usage of `esbuild` provides noticeable build time improvements as well as, on average, smaller output sizes.
`esbuild` currently does not support stylesheet sourcemaps. However, since the Angular CLI does not support component stylesheet sourcemaps when optimizing, this lack of support is problematic.
Global stylesheets will continue to use `cssnano` as an optimizer due to sourcemaps being required for global stylesheets even when optimizing. When `esbuild` adds stylesheet sourcemap support, global stylesheets may be transitioned to `esbuild` as well.
The logger API writes logs in an async fasion which previously caused messages not to be printed in the terminal when `process.exit` was invoked.
Closes#21322
With Webpack 5, the `raw-loader` is no longer needed and its functionality is provided via configuration options within the Webpack configuration via asset modules. Asset modules (https://webpack.js.org/guides/asset-modules/) provide a built-in way to provide `raw-loader`, `url-loader`, and `file-loader` functionality without additional dependencies.
In version 12.1, the framework added the `destroyAfterEach` an opt-in feature that improves tests performance and also addresses two long-standing issues.
The idea, is to have this enabled by default in the future. Related PR: https://github.com/angular/angular/pull/42566Closes#21280
Webpack 5 now provides type definitions for the majority of the watch subsystem. These type definitions allow the removal of the custom types that were previously used.
This change fixes `NG_PERSISTENT_BUILD_CACHE` sometimes creating cache
entries that live outside of the cache directory by using a hex encoding
rather than a base64 encoding. This error is caused because the base64
alphabet includes `/`. According to the webpack documentation [1] the
default `cacheLocation` is:
path.resolve(cache.cacheDirectory, cache.name)
Which means cache names with a leading `/` would remove the
`cacheDirectory` altogether.
[1]: https://webpack.js.org/configuration/other-options/#cachecachelocation
This reverts commit d4c5f8518d4801b9fd76de289a015dcbb8d8f69b.
Following a debugging and investigation with @petebacondarwin it appears that when the external template handling in the linker generates Babel AST nodes that reference the external template files which breaks Babel when it tried to flatten final source-map, which ends up no emitting any source-maps.
As an interim solution we should revert this.
Closes#21271
Webpack now provides loader function type definitions. These type definitions are now used in custom loaders within the package.
This improves type safety and behavior correctness of the loaders when used with Webpack.