Skip to content
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

Attribute noModule is ignored by Safari 10 #14680

Closed
Embraser01 opened this issue Jun 5, 2019 · 3 comments · Fixed by #14716
Closed

Attribute noModule is ignored by Safari 10 #14680

Embraser01 opened this issue Jun 5, 2019 · 3 comments · Fixed by #14716
Assignees
Labels
area: devkit/build-angular freq1: low Only reported by a handful of users who observe it rarely severity3: broken type: bug/fix
Milestone

Comments

@Embraser01
Copy link

🐞 bug report

Affected Package

The issue is caused by the use of the `nomodule` attribute in the `<script>` tag.

Is this a regression?

Yes, it was working in Angular 7

Description

The build generated by Angular v8 with both es5 and es2015 flavor cannot be loaded on Safari 10. It's caused by the fact that Safari doesn't seems to acknownledge the nomodule attribute and so, load both versions which leads to an 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

You can see a simple (no config) repo here and here, the same site deployed.

🔥 Exception or Error

You can see in the console


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

🌍 Your Environment

Angular Version: v8.0.0




     _                      _                 ____ _     ___
    / \   _ __   __ _ _   _| | __ _ _ __     / ___| |   |_ _|
   / △ \ | '_ \ / _` | | | | |/ _` | '__|   | |   | |    | |
  / ___ \| | | | (_| | |_| | | (_| | |      | |___| |___ | |
 /_/   \_\_| |_|\__, |\__,_|_|\__,_|_|       \____|_____|___|
                |___/
    

Angular CLI: 8.0.1
Node: 10.15.0
OS: win32 x64
Angular: 8.0.0
... animations, common, compiler, compiler-cli, core, forms
... language-service, platform-browser, platform-browser-dynamic
... router

Package                           Version
-----------------------------------------------------------
@angular-devkit/architect         0.800.1
@angular-devkit/build-angular     0.800.1
@angular-devkit/build-optimizer   0.800.1
@angular-devkit/build-webpack     0.800.1
@angular-devkit/core              8.0.1
@angular-devkit/schematics        8.0.1
@angular/cli                      8.0.1
@ngtools/webpack                  8.0.1
@schematics/angular               8.0.1
@schematics/update                0.800.1
rxjs                              6.4.0
typescript                        3.4.5
webpack                           4.30.0

Anything else relevant?

It seems to be related to Safari ignoring nomodule attribute.
It affect at least Safari 10.0.0 (on iOS 10.3).
I'll test on more devices but it takes some time (I test on simulator).

I also found this

@alan-agius4 alan-agius4 transferred this issue from angular/angular Jun 5, 2019
@alan-agius4 alan-agius4 self-assigned this Jun 5, 2019
@alan-agius4 alan-agius4 added area: devkit/build-angular freq1: low Only reported by a handful of users who observe it rarely severity3: broken type: bug/fix labels Jun 5, 2019
@ngbot ngbot bot added this to the Backlog milestone Jun 5, 2019
@alan-agius4 alan-agius4 modified the milestones: Backlog, 8.0.x Jun 5, 2019
@Embraser01
Copy link
Author

Actually, there is already the polyfill to fix this inside polyfill-es2015 but doesn't seems to work... (maybe it's loaded after es5 version?)

https://caniuse.com/#feat=es6-module

@trotyl
Copy link
Contributor

trotyl commented Jun 9, 2019

Technically speaking, Safari 10 isn't on the support list, current stable version is 12 so that officially supported versions are 11 and 12.

kyliau pushed a commit that referenced this issue Jun 11, 2019
10.1 and iOS Safari 10.3

The nomodule polyfill needs to be loaded prior to any script and be
outside of webpack compilation because otherwise webpack will cause the
script to be wrapped in `window["webpackJsonp"]` which causes it to
fail.

This polyfill will only be injected when the either Safari 10.1 or iOS
Safari 10.3 support is required, which is based on the browsers  defined in browserslist file.

Fixes #14680
kyliau pushed a commit that referenced this issue Jun 11, 2019
… and iOS Safari 10.3

The nomodule polyfill needs to be loaded prior to any script and be
outside of webpack compilation because otherwise webpack will cause the
script to be wrapped in `window["webpackJsonp"]` which causes it to
fail.

This polyfill will only be injected when the either Safari 10.1 or iOS
Safari 10.3 support is required, which is based on the browsers  defined in browserslist file.

Fixes #14680
@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
area: devkit/build-angular freq1: low Only reported by a handful of users who observe it rarely severity3: broken type: bug/fix
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants