Created
February 22, 2017 17:10
-
-
Save joseph-montanez/d0a8df95f6632c92deb2e643024833d1 to your computer and use it in GitHub Desktop.
Unable to export Opal code as a node module
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'native' | |
$$[:exports] = { | |
:pageLoaded => 123 | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var mainPage = require('./main-page.rb.js'); | |
console.log(mainPage.pageLoaded); # Output: undefined | |
console.log(mainPage.Opal.gvars.global.native.exports.pageLoaded); # Output: 123 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
opal -E -c main-page.rb > main-page.rb.js | |
node main.js |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment