Open jrowlingson opened 7 years ago
Agree. It's sort of a fake benefit here since the addon is simply exporting the global. Perhaps this would work inside index.js
this.import('vendor/js.cookie.js', {
using: [{ transformation: 'amd', as: 'js-cookie' }]
});
I think I prefer this approach over using a vendor-shim. I took this for a quick test here but I am observing the Cookies
global is still being set on window
.
I will take a closer look when I get a chance.
ah I see... it may not be possible with the regular js-cookie build.
Looking at the way the code is loaded:
js-cookie is looking for define.amd
https://github.com/js-cookie/js-cookie/blob/master/src/js.cookie.js#L10
and ember's amd loader has this mention... https://github.com/ember-cli/loader.js/blob/master/lib/loader/loader.js#L239
As of ember 2.15 app.import
supports importing files from node_modules
Ideally, it would be nice to employ a vendor-shim to avoid setting a global.