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

Use of global require can cause conflicts with 3rd party AMD-based scripts #63

Open
simonihmig opened this issue Feb 18, 2021 · 0 comments

Comments

@simonihmig
Copy link

I am trying to have an Ember app embedded into a 3rd party page, and to coexist peacefully with its JS assets, including those based an AMD modules, that use incompatible implementations of define() and require() than those that Ember/loader.js defines (globally!).

Using either the approach to call loader.noConflict() (see ember-cli/loader.js#204) at the end of app.js or using transforms like https://github.com/richardaiko/ember-derequire fail due to this addon patching (and later reverting) the global require() here. In the case of using noConflict(), what happens is that noConflict() reverts correctly, but this addon reverts it overwritten require() afterwards, but again with Ember's version. So the globally defined one remain that of Ember/loader.js, which breaks other 3rd party scripts relying on the original AMD version.

Not sure how best to fix this universally. FWIW, I ended up removing @classic due to this...

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

No branches or pull requests

1 participant