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

Running under Node.js with AMD fails #36

Closed
kitsonk opened this issue Oct 13, 2012 · 1 comment
Closed

Running under Node.js with AMD fails #36

kitsonk opened this issue Oct 13, 2012 · 1 comment

Comments

@kitsonk
Copy link
Contributor

kitsonk commented Oct 13, 2012

It appears that some modules attempt to detect AMD, but if they do, the fail to return properly when trying to require() in modules.

Using Dojo's dojo/node module to require in perstore like the following:

define([
  "dojo/node!perstore/stores",
  "dojo/node!perstore/model"
], function(stores, model){
  // ...
});

Will return the following output:

/node_modules/perstore/errors.js:2
var AccessError = exports.AccessError = ErrorConstructor("AccessError");
                                        ^
TypeError: undefined is not a function
    at Object.<anonymous> (/Users/kitsonk/github/dote/node_modules/perstore/errors.js:2:41)
    at Module._compile (module.js:449:26)
    at Object.Module._extensions..js (module.js:467:10)
    at Module.load (module.js:356:32)
    at Function.Module._load (module.js:312:12)
    at Module.require (module.js:362:17)
    at require (module.js:378:17)
    at Object.<anonymous> (/Users/kitsonk/github/dote/node_modules/perstore/facet.js:7:21)
    at Module._compile (module.js:449:26)
    at Object.Module._extensions..js (module.js:467:10)

Because there is a globally defined define() the util/extend-error.js fails to export the properly for the calling code, which is not AMD aware.

@kitsonk
Copy link
Contributor Author

kitsonk commented Oct 13, 2012

Actually, looking further into this, it would be better for the dojo/node AMD pluggin to descope define before attempting to require in the modules.

@kitsonk kitsonk closed this as completed Oct 13, 2012
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

1 participant