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

What's the correct way of using forge.min.js and require.js(amd) together ? #197

Closed
dcu opened this issue Nov 24, 2014 · 4 comments
Closed
Milestone

Comments

@dcu
Copy link

dcu commented Nov 24, 2014

Should I include it before require.js? after? how can I require it?

I am having a really hard time including forge as part of my project and require.js is not very helpful when printing the errors.

can someone please point me in the right direction?

EDIT1:
This is for a client-based app and not a nodejs-based server.

EDIT2:
If I modify the forge.min.js file to give a name to the module like: define("js/forge", [], t) it seems to work. I'm testing this atm.

EDIT2:
I had to set it to "/vendor/js/forge.js" so the web workers can load it. This is all very hackish and horrible so I'd like to find a proper solution. It's good enough for the moment because I was tired of spending time fighting the tool rather than solving my actual problem.

@dlongley
Copy link
Member

Sorry, we definitely need more documentation in this area. PRs are welcome.

I think most people are using the minified file on its own. It comes with a built-in super-simple AMD loader that mimics require.js called almond. I'm not sure how many people are using forge, in its entirety, in a Web Worker, though it should work. Obviously, it should be more clear how to do it and we should have examples. The include API for Web Workers is also a bit awkward w/respect to path names in general -- so it may be difficult to provide a solution that works across all setups. Again, we'd welcome advice from how people in your situation would prefer it to work and/or PRs to make it happen and keep everything still working in other scenarios.

@dlongley
Copy link
Member

Note that there's another issue with some plans for getting better built tools into forge in general here: #126. We'd prefer to eventually have a build stack that can support a number of different platforms/use cases more easily.

@dcu
Copy link
Author

dcu commented Nov 27, 2014

@dlongley I tried switching to almond but then other plugins were not compatible with the require method (they were passing different arguments to it making it crash).

@dlongley
Copy link
Member

Addressed by #456.

@davidlehn davidlehn added this to the v0.7.0 milestone Jan 12, 2017
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