Skip to content

zone.js ES2015 distribution can't be easily consumed #35157

@IgorMinar

Description

@IgorMinar

🐞 bug report

Affected Package

The issue is caused by package zone.js

Is this a regression?

no

Description

zone.js does not ship an esm2015 distribution that is discoverable by tooling: see https://unpkg.com/browse/zone.js@0.10.2/package.json (there is no module property in package.json pointing to dist/zone-evergreen.js (the ESM2015 file)

We created zone-evergreen.js as part of the pre-requisites for the differential loading story in v8, but rather than changing the zone.js layout and requiring a migration for all Angular apps we kept the deep import into zone.js/dist/zone in polyfills.ts file:

https://github.com/angular/angular-cli/blob/5376a8b1392ac7bd252782d8474161ce03a4d1cb/packages/schematics/angular/application/files/src/polyfills.ts.template#L55-L58

and instead implemented a custom resolution alias for es2015 polyfills:

https://github.com/angular/angular-cli/blob/878e4473e0a8517f8eab529ac71f0d6e8a454447/packages/angular_devkit/build_angular/src/utils/webpack-browser-config.ts#L114

We should clean up the package layout, roll out a migration for existing Angular CLI apps and remove the hack/custom resolution from the CLI.

🌍 Your Environment

Angular Version:


Angular CLI: 9.0.0-rc.11
Node: 12.14.1
OS: linux x64

Angular: 9.0.0-rc.11
... animations, cli, common, compiler, compiler-cli, core
... elements, forms, language-service, platform-browser
... platform-browser-dynamic, router, service-worker
Ivy Workspace: Yes

Package                           Version
-----------------------------------------------------------
@angular-devkit/architect         0.900.0-rc.11
@angular-devkit/build-angular     0.900.0-rc.11
@angular-devkit/build-optimizer   0.900.0-rc.11
@angular-devkit/build-webpack     0.900.0-rc.11
@angular-devkit/core              9.0.0-rc.11
@angular-devkit/schematics        9.0.0-rc.11
@angular/cdk                      9.0.0-rc.8
@angular/material                 9.0.0-rc.8
@ngtools/webpack                  9.0.0-rc.11
@schematics/angular               9.0.0-rc.11
@schematics/update                0.900.0-rc.11
rxjs                              6.5.3
typescript                        3.7.4
webpack                           4.41.2
    

Anything else relevant?

The solution will likely mean that zone.js will need to be restructured to match the simplified APF format with each file under dist/ being a directory with a fake package.json file similar to how https://unpkg.com/browse/@angular/core@8.2.14/testing/package.json works.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions