-
-
Notifications
You must be signed in to change notification settings - Fork 9
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
Configurable shim module format - AMD or ES2015 #99
Conversation
I don't have a complete understanding of the underlying Ember build systems, so I'm uncertain whether this solution will have unwanted side effects. I did some testing against one of our apps, where an Ember client wraps a HTML5 game framework. The game code that relies on the AMD jQuery alias started working again, and none of our Ember code was adversely affected, even the components that use |
The Travis CI run failed due to an unrelated issue. The release-it dependency is failing to install due to the Node version. |
Although I did that shim change back then, I see myself unable to make a final call here, as I am not sure we want to support this here. My understanding is:
I wondered why the AMD shim actually worked with Ember, but it seems there is some explicit compatibility support in Can we eventually rely on that feature, and just use an AMD shim? Any thoughts @rwjblue?
Indeed, also failing for dependabot updates. Seems that package did not really follow semver! I dropped node 6 support here: #100 |
This is great background, thanks @simonihmig, especially the info on how ember-cli/loader's Thanks for patching the Travis failure, this PR is all green now 🍏 I'll wait to hear from others, before digging further into Ember's vendor-shim functionality (I've not worked with it before). |
082d61b
to
67cd81d
Compare
No, we are trying to deprecate/remove |
@timiyay - Can you explain more about your usage of loader.js? Are you manually doing |
@rwjblue I'll give my best explanation, with the caveat that I'm working on a legacy system I don't 100% understand just yet. We have a HTML5 game framework which uses AMD modules. These games are embedded within our client Ember apps. The Ember apps are responsible for loading the game manifests, and executing the relevant game module. At this point, the game module takes over, and loads its modules via AMD. Since the games are always served within in Ember app, the game framework uses ember-cli/loader as its AMD module loader, instead of RequireJS. We also recycle the Ember-provided jQuery and use it within the games. We recently upgraded ember-jquery to 0.6.1, because we needed jQuery 3.4.1 for an iOS 10 bugfix. This caused our game AMD loading to hit an issue, when it attempts to require jquery, as it expects an AMD module but receives an object It sounds likely that our legacy module system using ember-cli/loader will need a rework in the near future, but it's no mean feat, so we're looking for strategies to maintain compatibility for as long as possible. |
I think you could probably fix the issue by defining your own |
@rwjblue Hey yeah this crossed my mind, but I'm yet to properly consider it. To be clear, you're suggesting we could skip Would this nerf |
No, I was more thinking that you could use // vendor/jquery/shim.js
define('jquery', [], function() {
self.jQuery.default = self.jQuery;
return self.jQuery;
}); Then the |
Ah brilliant! I didn't connect the dots that files in the This fixes our issue, and seems like a reasonable solution for us. |
This proof-of-concept PR suggests a solution to #98. It allows downstream apps to choose the module format for the ember-query shim added in #33.
This solves an issue for AMD-dependent systems like one of ours, which uses ember-cli/loader to set up a module alias. This was breaking down when receiving the shim in ES2015 format.