-
Notifications
You must be signed in to change notification settings - Fork 673
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
Requirejs does not load module synchronously when a context based config is used #662
Comments
This error:
Seems to indicate that it tried to load, but was just at the wrong path. I think the issue is that Closing as I think that is the issue, but feel free to continue discussion here and we can reopen if there is another issue. |
@jrburke , I can reproduce this problem even when using And here is something that I find puzzling. Even if the interpretation of |
@lddubeau if you have a test case I can try, that will likely be the easiest way to get to the issue. |
Putting this in 2.1.12 bucket for further triage, not sure if it will make 2.1.12 though, or the root cause yet. |
StackOverflow link
When using context based configs, requirejs does not load modules synchronously as suggested by the docs:
"... when running in Node, module loading will be loaded using sync IO calls, and loader plugins should resolve calls to their load method synchronously."
Here's my test case:
A.js
spec.js
When I run the test
mocha spec.js
, I get the following error:Uncaught Error: Tried loading "A" at /Users/khirakawa/work/test/node_modules/mocha/bin/A.js then tried node's require("A") and it failed with error: Error: Cannot find module 'A'
Interestingly,
{test: 'test1'}
gets logged 100 times, which seem to suggest that synchronous loading is happening, but there also seems to be something else going on that causes this issue.Some other observations:
localReq("/Users/khirakawa/work/test/A.js")
tests/node/syncRequire/main.js
to use a context. The test failed.Here's my modified
main.js
testa
is undefined.Would be great to know why this happens. Thanks!
The text was updated successfully, but these errors were encountered: