Skip to content

nomodule polyfill does not work when deferred #15275

Closed
@kevinbuhmann

Description

@kevinbuhmann

🐞 Bug report

Command (mark with an x)

- [ ] new
- [x] build
- [ ] serve
- [ ] test
- [ ] e2e
- [ ] generate
- [ ] add
- [ ] update
- [ ] lint
- [ ] xi18n
- [ ] run
- [ ] config
- [ ] help
- [ ] version
- [ ] doc

Is this a regression?

Yes, the previous version in which this bug was not present was: 8.1.1

Description

I believe #15087 breaks the nomodule polyfill for older iOS/Safari. The nomodule polyfill script is now deferred by default and does not seem to work unless I remove the defer attribute.

🔥 Exception or Error

In the reproduction above, "Angular is running in the development mode. Call enableProdMode() to enable the production mode." is logged twice indicating that both the es5 and es2015 scripts were executed. You can prove this by added a console.log to main-es5.js and main-es2015.js.

In my internal application:


polyfills-es2015.d441479….js:1 Error: Zone.js has detected that ZoneAwarePromise `(window|global).Promise` has been overwritten.
Most likely cause is that a Promise polyfill has been loaded after Zone.js (Polyfilling Promise api is not necessary when zone.js is loaded. If you must load one, do so before loading zone.js.)

🔬 Minimal Reproduction

  1. ng new ...
  2. Add "iOS >=10" to browserslist to enable the nomodule polyfill.
  3. ng build
  4. Serve the output files using a static file server.
  5. Open the site in iOS 10 (iPhone 7 Safari for example).
  6. You can remove the defer attribute from the nomodule polyfill script in index.html manually and refresh to see the problem go away.

🌍 Your Environment


Angular CLI: 8.2.0
Node: 10.15.3
OS: win32 x64
Angular: 8.2.0
... animations, cli, common, compiler, compiler-cli, core
... elements, forms, language-service, platform-browser
... platform-browser-dynamic, platform-server, router

Package                                    Version
--------------------------------------------------------------------
@angular-devkit/architect                  0.802.0
@angular-devkit/build-angular              0.802.0
@angular-devkit/build-optimizer            0.802.0
@angular-devkit/core                       8.2.0
@angular-devkit/schematics                 8.2.0
@nguniversal/common                        8.1.1
@nguniversal/module-map-ngfactory-loader   8.1.1
@schematics/angular                        8.0.0
@schematics/update                         0.802.0
rxjs                                       6.5.2
typescript                                 3.5.3
webpack                                    4.29.5

Anything else relevant?
This happens on iOS 10.3 and probably older.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions