-
Notifications
You must be signed in to change notification settings - Fork 594
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
Support for environments without window object (either as RequireJS/AMD, or global polyfill) #14
Comments
On further inspection, it looks like support in environments that use AMD is almost automatic; you'd have to take out the wrapping from vendor/loader.js. Then you'd have just a set of AMD modules, and you could do: var Promise = require('promise/promise').Promise; almost the same as the Node version. The only difference would be that you would have to define the locations of promise/*. For the moment I'm going to hack around this by removing the vendor/loader.js and requireModule('promise/polyfill').polyfill(); by hand, but this is something a new Grunt task could probably do. |
Unfortunately even after stripping loader.js & the last line, what remains is not valid AMD syntax. The build task releases a *.amd.js file but it suffers the same issue. |
Interesting. In case it's helpful, I got it to work through the following:
I'm not sure that RequireJS is really ok with keeping multiple modules in the same file, but it is functional as far as my use cases have gone. |
For multiple modules in the same file you can use bundles since RequireJS 2.1.10. In my RequireJS config it looks like this:
|
should be fixed on master |
The current polyfill works in browsers and (I assume) node, but not in evaluation environments without the window object.
(One module already uses var browserGlobal, so I'll see if I can extend that support in the rest of es6.)
The text was updated successfully, but these errors were encountered: