The `@angular-devkit/build-optimizer` package now officially supports Webpack 5.
Webpack 4 support is temporarily maintained while the remainder of the tooling is transitioned.
This change prevents the build optimizer from removing the operator add imports from the rxjs package (for example, `import 'rxjs/add/operator/filter';`). The entire rxjs package is currently marked as side effect free from within the rxjs `package.json` but the files in the add directory intentionally contain side effects.
The rxjs package contains module level side effects that are not marked with a pure annotation. However, these side effects are safe to remove if the values are unused.
This change lowers the potential for code to be errantly removed by the prefix functions and scrub file transformers. Only known safe modules are used with the prefix functions transformer as it can easily remove required module level side effects (as opposed to global level side effects) such as `__decorate` calls.
The scrub file transformer will now keep metadata if non-Angular decorators are present. This allows libraries that use that information to continue to function.
Closes#14033Closes#18621
A Webpack module's `factoryMeta` property is not guaranteed to be defined. This change ensures that the build optimizer skip property is added even in the case of no `factoryMeta` currently defined.
This commit makes a few minor changes to enable syncing the CLI repository
into google3.
1. mark pkg_tar and pkg_npm as external
2. remove dependencies (marked as comment) which are stale in google3
3. remove TS files generated from JSON schema in BUILD files since these
files are compiled and added to the g3 codebase at sync time
4. Some minor typing changes
5. Remove duplicate licenses
6. mark dependencies which are not available in g3 as external
7. Immediately type the result of JSON.parse() as required by g3 linter.
Otherwise, the type defaults to `any`.
With this change we "vendor" TypeScript 3.6 in build optimizer instead of using directly the npm package.
Reasons:
- We cannot update to a more recent version of TypeScript due to https://github.com/microsoft/TypeScript/issues/38412
- Yarn workspace are not supported under Bazel. This means currently we are running unit testswhich uses a different TypeScript version at runtime.
- In TypeScript 3.9, the shape of ES2015 classes changed https://github.com/microsoft/TypeScript/pull/32011, this requires some changes in the UT expects, but this again will not be correct to change now.
BREAKING CHANGE
Deprecated and outdated optimization passes class fold and import tslib have been removed.
Note: This change only effects direct @angular-devkit/schematics users and not the application developers.
Contains fixes related to the symlink behaviour inside of bazel. Without it, webpack needs to be configured to be aware of symlinks and preserve the paths.