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

Transpile x=require(y?'foo':'bar') to require('foo');require('bar');x=require(y?'foo':'bar'); #12

Open
arian opened this issue Feb 12, 2014 · 0 comments

Comments

@arian
Copy link
Member

arian commented Feb 12, 2014

If the require() module name is dynamically determined with a ternary, which has two strings, requiring both modules first, to make sure they are both available.

Somehow wrapup already fixes this almost, but when outputing it as AMD, and using requirejs, and one of the modules is not yet loaded yet, then requirejs does not statically load both modules upfront, so it will require(x?'a':'b') while a or b are not defined yet, resulting in an error. If prefixing require('a'); require('b') requirejs will make sure both modules are loaded, before doing the require(x?'a':'b');.

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