You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This would be a variant of the call node. That would under the hood become a webpack require that gets assigned to the some_module variable and Opal would not try to find it as an Opal module. It could even do the JS syntax under the hood so that you can call methods, etc. on it easily (see 2nd line above).
The text was updated successfully, but these errors were encountered:
wied03
changed the title
Test requiring node modules
Require node modules from Opal
Apr 12, 2016
@cj - Never mind. 1) we can't load all the node stuff in there because it will throw off the phantomJS stuff in the test. 2) More importantly, the stdlib require is runtime. We need a compile time 'require' for webpack to pick up.
Would there be a similar issue doing #2 or would it be simpler as you're just converting #= require foo to %x{require('foo')}? I'm using %x because it won't let me escape ` lol
I think this should be quite different than #2. #2 would scan source code to do that. This, to be robust, really needs to be compiler driven. Not hard though (probably 5-10 lines of code) + the tests. Just isn't as high on my individual priority list.
Currently, you cannot require node modules from Opal without using back ticks or
JS
syntax. (see Requires under README).What would also need to happen, is to monkey patch the Opal compiler to allow the following:
This would be a variant of the call node. That would under the hood become a webpack require that gets assigned to the
some_module
variable and Opal would not try to find it as an Opal module. It could even do theJS
syntax under the hood so that you can call methods, etc. on it easily (see 2nd line above).The text was updated successfully, but these errors were encountered: