-
Notifications
You must be signed in to change notification settings - Fork 226
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
Require.js loading issue #52
Comments
Yes the error continues. Seems to me that in the new version ends this problem. |
I looked at the source code and it seems that there is two problems
|
Currently AMD loading can not work as it is. The simplest solution to this problem would be to build two file :
The autobahn.js file can be provided in a single file with when module inside nevertheless we must point out that the "exports" feature in requireJS would not work as expected due to the when module definition see http://requirejs.org/docs/api.html#config-shim require.config({
baseUrl: ".",
paths: {
"autobahn": "//autobahn.s3.amazonaws.com/js/autobahn"
},
shim: {
"autobahn": {
exports: 'ab'
}
}
}); The autobahn.amd.js would not include include when module and therefore would require when as a module dependency in the require.js configuration. require.config({
baseUrl: ".",
paths: {
"autobahn": "//autobahn.s3.amazonaws.com/js/autobahn",
"when": "//cdnjs.cloudflare.com/ajax/libs/when/2.7.1/when"
},
shim: {
"autobahn": {
deps: ["when"]
}
}
}); What do you think about it ? |
Are you having the issue with the old WAMP v1 implementation? https://github.com/tavendo/AutobahnJS/tree/wamp1 or the new AutobahnJS for WAMP v2 https://github.com/tavendo/AutobahnJS ? The new AutobahnJS is built for browsers using Browserify. The old AutobahnJS did include manual code trying to make it compatible with usual module systems. |
If this refers to the old AutobahnJS (WAMPv1) implementation: this is no longer supported anyway. If the issue is for the new implementation, please reopen .. |
Ive got the same error. Any solution ? I think i tried every possible configuration. I tried to use autobahn directly from autobahn.s3.amazonaws.com/js/autobahn and also i installed it through bower. In first case ive got an error "ReferenceError: ab is not defined" and in second case its seem that there is e problem with loading "submodules" as when and session and the other that are required by autobahn. "ReferenceError: module is not defined module.exports = require('./lib/autobahn');" so it look like there is problem with module.export. I tried to load all libs manually without any success. I will be very very gratefull for any advice , how to run autobahn with requirejs , it took me too much time already. Btw. i`m using the newest version. |
this also works: https://github.com/tavendo/AutobahnJS/blob/master/package/test/test_require2.html I've added this info to the readme: https://github.com/tavendo/AutobahnJS#amd-and-requirejs |
Thanks. That works. But there is another issue. I |
Probably Ratchet is not yet on version 2 of WAMP .. |
Ratchet is still on v1. You should use the AutobahnJS version that is compatible with v1 of the WAMP protocol. |
@galthron In this case, you should use: https://github.com/tavendo/AutobahnJS/tree/wamp1 @cboden Any plans to upgrade Ratchet to v2? |
I do plan to. I just haven't had much time for OS lately, unfortunately. |
When loading autobahn as an AMD module I get the following error
Uncaught ReferenceError: ab is not defined
with the following sample :Am I doing something wrong or is this a bug ? I've looking for previous PR and it seems #49 should have corrected this problem according to @hugohenrique who related the same issue in #35 .
The text was updated successfully, but these errors were encountered: