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 not defined" when implemeting using requireJS #60

Closed
bengsfort opened this issue Jun 5, 2014 · 7 comments
Closed

"vex not defined" when implemeting using requireJS #60

bengsfort opened this issue Jun 5, 2014 · 7 comments

Comments

@bengsfort
Copy link

Working on a web app and trying to implement Vex Dialogs using requireJS. Everything compiles fine, however whenever I open the page all I get is a reference error saying vex is not defined. Have tried using the minified and unminified files, vex.dialog.js and vex.js.

In my gruntfile under paths:
jquery : 'extra/jquery-2.1.1.min',
. . . .
vex : 'extra/vex',

In my main.js, the file that calls it:
require([ "system", "ui", "jquery", "vex" ]);

Just to test it working I have the standard confirm demo pasted in, but continue getting the reference error. Is there something I'm just not doing correctly in terms of requireJS?

@neilkyoung
Copy link

I am having the same problem with this.

I add in the vex and vex.dialog libraries as per the documentation and I get:

Uncaught ReferenceError: vex is not defined

Does this library support AMD? The documentation suggests it does but I am unable to get it to work.

@timmfin
Copy link
Member

timmfin commented Jul 7, 2014

Could you show more of the code that creates the dialog? Are you requiring vex.dialog and then using vexDialog.alert (or are you using vex directly and not the vex.dialog shortcuts?). I'm going off of what I see in https://github.com/HubSpot/vex/blob/master/js/build-test-amd.html

ps: #64 may be helpful.

@dianafaye17
Copy link

I'm having the same issue.

@ferhtgoldaraz
Copy link

I think this is related to #141, and the fix could be to change "vex" to "vex-js" in the array of define dependencies as has been suggested on that issue: #141 (comment)

It worked for me, my define implementation is provided by webpack.

@markstos
Copy link
Contributor

Note there are big changes planned in the next version of vex is #160 you are encouraged to review the new changes and see if ti would meet your needs here.

@bbatliner
Copy link
Collaborator

bbatliner commented Aug 9, 2016

Hey all! #160 is merged and I want to make sure your problem is fixed. vex is now built with browserify's standalone option, which should make it compatible with all module systems, including requirejs and AMD.

If you don't mind, can you try the latest files (vex files & vex-dialog files or npm install vex-js@3.0.0-beta.1 vex-dialog) and let me know if they're working? Thanks!

@bbatliner
Copy link
Collaborator

Assuming this worked fine :)

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

7 participants