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

vex.combined and AMD #38

Closed
m4nuC opened this issue Dec 5, 2013 · 11 comments
Closed

vex.combined and AMD #38

m4nuC opened this issue Dec 5, 2013 · 11 comments

Comments

@m4nuC
Copy link

m4nuC commented Dec 5, 2013

I can't make vex.combined work with requireJS.
It seems to only work when using the separate vex.js and vex.diaolog.js ( like in the AMD exemple).
I was hoping to just load the vex.combined and be able to use vex.dialog. Possible?

@adamschwartz
Copy link
Contributor

Can you be more specific about what you mean when you you can't make it work with requireJS?

Including vex.js and vex.dialog.js (in that order) should be equivalent to including vex.combined.js.

@m4nuC
Copy link
Author

m4nuC commented Dec 6, 2013

It does work by including vex and vex.dialog separately. But I can't not make it work using vex.combined. when using vex.combined only the main vex object get exposed but not vex.dialog. is this a known bug ?

@m4nuC
Copy link
Author

m4nuC commented Dec 10, 2013

Still hoping to get that figured out if i have to go to production with this.. Are you aware of this issue or I am doing something wrong.

@adamschwartz
Copy link
Contributor

Sorry, my previous statement was incorrect. The vex.combined.min.js file has two define statements in it, so it cannot be used with RequireJS. We will add a note to the docs stating this.

If your goal is to use vex.dialog, you should be able to just require that, since it itself requires vex. If you need to use both vex and vex.dialog, you'll need to require them separately. There really would be no good way of requiring them as a single statement since they are separate modules. Hope this helps!

@adamschwartz
Copy link
Contributor

This is now in the docs.

screen shot 2013-12-11 at 4 18 49 pm

@m4nuC
Copy link
Author

m4nuC commented Jan 4, 2014

Ok thanks, would love to seem the AMD version only expose one object tho

@adamschwartz
Copy link
Contributor

@m4nuC can you elaborate?

@m4nuC
Copy link
Author

m4nuC commented Jan 4, 2014

I meant just having one object exposed in the vex.combined.min to make it usable when using AMD. Obviously not a big deal but that would to me look a bit nicer in my list of dependencies.

@adamschwartz
Copy link
Contributor

Unfortunately (and @zackbloom or @timmfin please correct me if i'm wrong), I believe the only way to accomplish this would be to actually combine the source code of vex.coffee and vex.dialog.coffee, thus limiting others' ability to depend on only one or the other separately.

Generalized, this is an interesting AMD question, and one I'd certainly like an answer to: Can one structure her code such that modules A and B (in which B depends on A) can be required as a single module C or individually as modules A and B respectively? If you figure it out, please report back and let us know. 😉

@m4nuC
Copy link
Author

m4nuC commented Jan 4, 2014

Well can't module C require B (which require A) and then just expose a C module that can itself expose B module through a member on itself ? I would try it out but I am not exactly a coffee scripter :(

@adamschwartz
Copy link
Contributor

That sounds reasonable. I can give it shot next week. Thanks!

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

2 participants