Stop modifying require.extensions in the top level. #3054

Closed
wants to merge 1 commit into
from

Projects

None yet

4 participants

@BYVoid
BYVoid commented Jun 29, 2013

require.extensions should not be modified in the top level. For example, variable require.extensions of a script file that loads coffee script by using var coffee = require('coffee-script') is modified unexpectedly. require.extensions should remains as-is until 'run' is explicitly called.

By implementing this, I created another script file named compile-helper.coffee and moved some functions from coffee-script.coffee to it. In 'compile-helper.coffee' the new function is named registerRequire, which replaced the code in the top level before. registerRequire is called in function run of coffee-script.coffee.

@vendethiel
Collaborator

See #2323

@jashkenas
Owner

Done. You now have to require coffee-script/extensions to enable 'em.

@jashkenas jashkenas closed this Oct 20, 2013
@michaelficarra
Collaborator

@jashkenas: Not true. You may want to check out michaelficarra/CoffeeScriptRedux@23a597e to see how I did this in CSR. Let's try to get this fixed up before 1.7.0.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment