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

errors ignored on second require() call #911

Closed
also opened this issue Oct 15, 2013 · 0 comments
Closed

errors ignored on second require() call #911

also opened this issue Oct 15, 2013 · 0 comments
Milestone

Comments

@also
Copy link

also commented Oct 15, 2013

Using requirejs 2.1.9 in node:

requirejs = require 'requirejs'
cb = (s) -> (result) -> console.log s, result
requirejs ['no_such_module'], cb('success 1'), cb('error 1')
requirejs ['no_such_module'], cb('success 2'), cb('error 2')

The first errback is called, then both success callbacks:

error 1 { [Error: Tried loading "no_such_module" at /Users/ryan/no_such_module.js then tried node's require("no_such_module") and it failed with error: Error: Cannot find module 'no_such_module']
  originalError: { [Error: Cannot find module 'no_such_module'] code: 'MODULE_NOT_FOUND' },
  moduleName: 'no_such_module',
  requireModules: [ 'no_such_module' ] }
success 1 undefined
success 2 undefined

This example works in 2.1.8.

It seems the handling of nested require errors changed between 2.1.8 and 2.1.9, although both were broken: 2.1.8 would call the first errback and nothing else, while 2.1.9 has the same behavior as above.

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