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

Using poly with no commonjs or amd #34

Closed
aeisenberg opened this issue Dec 19, 2014 · 8 comments
Closed

Using poly with no commonjs or amd #34

aeisenberg opened this issue Dec 19, 2014 · 8 comments

Comments

@aeisenberg
Copy link

In our environment, we are not using commonjs or amd (only angularjs modules). I'm not able to load function.js (or any module for that matter) when not using these module systems. Any suggestions on how to do this?

@aeisenberg
Copy link
Author

Guess we need a meta-poly to polyfill the polyfill. :)

@briancavalier
Copy link
Member

Hey @aeisenberg! Poly was designed to be used in amd and commonjs environments. The simplest option would probably be to browserify whatever poly module you need (like poly/all, poly/es5, or just poly/function if that's all you need). Using browserify's standalone option is usually a good way to build a modular library into a script that's loadable via <script> element.

Here's an example from when.js's package.json of the browserify command that can be used to build when.js for non-modular environments. I bet something similar would work for poly, like: browserify -s poly all.js -o poly.browserified.js

If that doesn't seem like a workable option, you could try es5-shim.

Hope that helps!

@aeisenberg
Copy link
Author

Thanks @briancavalier. I'll try browserify. The main reason we want to use poly is for its modularity and so we can keep things small. With es5-shim, we'd have to include the whole shebang, which is not needed in our case.

@briancavalier
Copy link
Member

Cool, let us know how it goes.

@unscriptable
Copy link
Member

Hey @aeisenberg, here's what another user tried successfully: #28 (comment)

@unscriptable
Copy link
Member

I updated the docs: https://github.com/cujojs/poly/blob/master/README.md#can-i-use-poly-without-a-module-loader

Hey @aeisenberg , I'm closing this for now, but please reopen it if you have any further issues. -- John

@briancavalier
Copy link
Member

@aeisenberg
Copy link
Author

Thanks! Works for me!

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

3 participants