Skip to content
This repository has been archived by the owner on Feb 26, 2024. It is now read-only.

fix(duplicate): fix #1081, load patch should also check the duplicate flag #1121

Merged
merged 1 commit into from
Jan 8, 2019

Conversation

JiaLiPassion
Copy link
Collaborator

fix #1081, __load_patch should also check duplicate flag.
So when we load zone.js multiple times, it will not throw ZoneAwarePromise already been patched error.

@DanielNetzer
Copy link

Any new on this PR, it is highly expected fix for Angular Elements loaded in Angular applications.

@oliverdavidt
Copy link

@JiaLiPassion Any update when this will be merged? I am in the same boat as @DanielNetzer and cannot use my Angular elements in Angular applications until zone.js can be loaded more than once.

@DanielNetzer
Copy link

DanielNetzer commented Sep 21, 2018 via email

@JiaLiPassion
Copy link
Collaborator Author

@DanielNetzer, @oliverdavidt, I think we need to wait for a bit longer for the release.
And currently, you guys can use my temp release branch for test.

"zone.js": "git://github.com/JiaLiPassion/zone.js#duplicate-dist"

@benoitjchevalier
Copy link

Any chance this could be merged into master? Right now I have a fork with that fix manually added to master so that I can get this + the customElements V1 fix (#1133) but I'm not a big fan of having to manually add stuff and rebuild, I would feel more confident if I could at least just pull master and build.

@vishnur-github
Copy link

@DanielNetzer, @oliverdavidt, I think we need to wait for a bit longer for the release.
And currently, you guys can use my temp release branch for test.

"zone.js": "git://github.com/JiaLiPassion/zone.js#duplicate-dist"

I am using this patch, still getting ZoneAwarePromise already been patched error

@mhevery mhevery merged commit 8ce5e33 into angular:master Jan 8, 2019
@rafagsiqueira
Copy link

@DanielNetzer, @oliverdavidt, I think we need to wait for a bit longer for the release.
And currently, you guys can use my temp release branch for test.

"zone.js": "git://github.com/JiaLiPassion/zone.js#duplicate-dist"

I am using this patch, still getting ZoneAwarePromise already been patched error

I tried and had the same problem. ZoneAwarePromise already been patched.

@JiaLiPassion
Copy link
Collaborator Author

@rafagsiqueira , could you post a reproduce repo? Thanks!

@JiaLiPassion JiaLiPassion deleted the duplicate-patch branch January 8, 2019 14:38
@JiaLiPassion
Copy link
Collaborator Author

@rafagsiqueira, @vishnur-github, could you try this branch?

"zone.js": "git://github.com/JiaLiPassion/zone.js#release-20190108"

I test it with the following cases.

<html>

<head>
    <script src="./zone.js"></script>
    <script src="./zone.js"></script>
    </script>
    <script>
            Zone.current.fork({name: 'test'}).run(() => {
                setTimeout(() => {
                    console.log('zone is:', Zone.current.name);
                });
            });
    </script>
</head>

</html>

Everything work fine.

@lexigren
Copy link

With this version error has disappeared, but application went in infinite reload loop.

@JiaLiPassion
Copy link
Collaborator Author

@lexigren, could you provide a reproduce repo? And could you show me the stack trace of the infinite loop?
Thanks

@lexigren
Copy link

lexigren commented Jan 10, 2019

I can't provide repo since it's private. It happens while I'm trying to use created with angular Pixie image editor inside another angular app, only in prod mode, during execucting polyfills, when polyfill "0TWp" (which is import 'zone.js/dist/zone') runs. Instead of usual "Zone already loaded" after its execution, and bunch of executions "Zone.__load_patch" whole process starts allover again without any error.
Pixie had it's own zone import in polyfills, which I removed, and everything worked in dev mode, but in prod mode it seems to be running outer application polyfills again, thus causing infinite loop.
Maybe it's caused by Pixie loading process, still trying to figure it out.

Edit:
That was webpack problem. There were a conflicting jsonpFunctions. Since angular cli does not allow to set jsonpFunction it can be modified in node_modules/webpack/lib/WebpackOptionsDefaulter.js for a single build purposes.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Runtime Error Zone already loaded
9 participants