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

Changes in global behavior impact multiple javascript libraries #289

Closed
brunops opened this issue Mar 21, 2017 · 3 comments
Closed

Changes in global behavior impact multiple javascript libraries #289

brunops opened this issue Mar 21, 2017 · 3 comments

Comments

@brunops
Copy link

brunops commented Mar 21, 2017

I'm reviving the issue reported in #278 as it seems to be a real problem to Magento websites (they use prototype.js 1.7.0)

Explained the same problem in more detail in babel/babel#5518

This change in behavior trickles down into how google tag manager works and can break other things in a website.

@brunops brunops changed the title Changes global behavior on Magento websites Changes in global behavior impact Magento websites Mar 21, 2017
@danielpgross
Copy link

I can confirm that the exact same issue is breaking RequireJS in my application. The affected code is here: https://github.com/requirejs/requirejs/blob/f2335026867afd80c394247bfe5278d2bd8f32ee/require.js#L47-L49
In my case, it actually causes RequireJS injected modules to be passed in as undefined.
This is a very obscure bug and it therefore led to very confusing and difficult-to-debug behaviour. I spent almost 2 days identifying the exact issue.

I imagine that PrototypeJS and RequireJS are not the only other libraries affected by this global change; the title of this issue should probably be "Changes in global behavior impact multiple javascript libraries". When working with a legacy application, it's often not possible to simply swap out the problematic legacy JS library, so a fix here is critical.

Thank you!

@brunops brunops changed the title Changes in global behavior impact Magento websites Changes in global behavior impact multiple javascript libraries Apr 20, 2017
@danielpgross
Copy link

danielpgross commented Apr 24, 2017

A workaround is to reset the toString() return value for Arrays to the ES5 default by including the following in your bundle:

Object.defineProperty(Array.prototype, Symbol.toStringTag, { value: "Array" });

@hooblei
Copy link

hooblei commented Jun 30, 2017

Looks like cb30530 fixes the issue but hasn't been released yet ... ?

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

No branches or pull requests

4 participants