Closed sunny-g closed 9 years ago
I installed stellar-base
into an npm module. Then called browserify
(10.2.6) on it manually and it did not succeed. It errors when reading build/Release/native.node
file in the ed25519
module used by stellar-base. Says it sees an unexpected character. This makes me think stellar-base doesn't support being browserified.
I looked at their github page and it says to use bower to install it in the browser. It doesn't mention browserify or have a browserify option in its package.json
.
When I installed the module on my iMac it compiled some platform specific stuff for ed25519
.
Perhaps stellar-base is not browserify-able as-is ?
When using browserify manually it works when i do --exclude "ed25519/**"
. I used the options file to specify the exclude in a meteor app, but, it still prints the array about being unable to call split on undefined (I edited the plugin to explicitly set the exclude as well and it had no effect). I also excluded the native.node file, as well.
I don't know anything about stellar-base
. Is it something which should be browserify-able ?
Thanks @elidoran for helping out as I'm terribly unfamiliar with both browserify and webpack.
It looks like stellar-base
uses webpack with something (what I believe is a transform-equivalent called a loader) named babel-loader
. I found this info from the gruntfile.
I'm in the process of breaking out stellar-base
into it's own Meteor package, where I have:
meteor-stellar.browserify.js
with StellarBase = require('stellar-base')
meteor-stellar.browserify.options.json
with { "transforms": "babelify" }
(not working)Npm.depends
block that specifies stellar-base
and babelify
in the package's package.js.At the moment, this way of going about it is broken, I believe because my options
are broken and not exactly parallel to what the original gruntfile is doing. Any thoughts? What did your changes to the browserify.options.json
look like (for my own reference)?
For reference, I started with options:
{
"exclude" : [ "ed25519/**"]
}
Because, doing browserify ./stellar-base --exclude "ed25519/**" -o stellar.js
completed successfully.
However, it didn't help in Meteor. I then changed Browserify to read that option and explicitly call browserify.exclude pattern
in the plugin. That still didn't solve it.
I looked at the gruntfile you referenced. It uses webpack and ignores all .node
files, which makes sense because that's what I was trying to ignore with the ed25519 stuff. It also doesn't build from the "main" script; it builds from src/browser.js
instead. Perhaps if they set a "browserify" property in their package.json file which pointed at that file it would help.
I have a better solution for you tho. Their README says they publish to Bower. There is a meteor package for bower: mquandalle:bower. So, I tried it and it works with stellar-base.
I have a simple meteor app I test things on. I added that bower package to it, added the below "bower.json" file in app/client/, the app ran, and StellarBase was available in the JavaScript console.
{
"name": "testcb",
"version": "0.1.0",
"dependencies": {
"stellar-base": "0.3.10"
},
"private": true
}
Please, let me know if that works for you.
I'm trying to
browserify
js-stellar-base directly into my app; I currently have it saved to mypackages.json
and can successfully use the package on the server.I have a
stellar.browserify.js
file inclient/lib
that contains onlyStellarBase = require('stellar-base')
and this is the error I get before it fully exits my Meteor process:Any clues as to what's causing this?