Skip to content

nomodule polyfill does not work when deferred #15275

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
kevinbuhmann opened this issue Aug 8, 2019 · 4 comments
Closed

nomodule polyfill does not work when deferred #15275

kevinbuhmann opened this issue Aug 8, 2019 · 4 comments

Comments

@kevinbuhmann
Copy link
Contributor

🐞 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.

@clydin
Copy link
Member

clydin commented Aug 8, 2019

Fixed via #15246 which has just been merged.

@clydin clydin closed this as completed Aug 8, 2019
@kevinbuhmann
Copy link
Contributor Author

Thanks!

@clydin
Copy link
Member

clydin commented Aug 8, 2019

An 8.2 patch version of the fix is also pending: #15276

@angular-automatic-lock-bot
Copy link

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Sep 9, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants