Closed genderev closed 3 years ago
Could you try installing the following and see if that helps?
"@babel/core": "^7.9.0",
"babel-plugin-module-resolver": "^4.0.0",
"babelify": "^10.0.0"
I think you needed to add --save-dev
to the cli
npm install babelify --save-dev
as babelify
needs to be a devDependency
Also you need to add the babelify -transform to the command line
browserify -t [ babelify --global ] index.js > bundle.js
@DougAnderson444 Thanks for chiming in, do you think you'd be up to submit a PR to the README which adds these details in the browserify section? Something along the lines of what you need to do to use the library in a browserify environment
I think this is also related to https://github.com/RangerMauve/dat-fetch/issues/10
Could you try installing the following and see if that helps?
"@babel/core": "^7.9.0", "babel-plugin-module-resolver": "^4.0.0", "babelify": "^10.0.0"
Yep, I was able to browserify the file after installing all of these!
I don't know if I should make a new issue :/ My entire webpage looks like this:
<!DOCTYPE html>
<html lang="en" dir="ltr">
<head><meta charset="utf-8"><title></title>
</head>
<body></body>
<script src="bundle.js"></script>
<script>
const SDK = window.datSDK
// Look at the examples from here
</script>
</html>
and I have this error in the console:
Uncaught Error: No native build was found for platform=browser arch=javascript runtime=node abi=undefined uv= libc=glibc node=undefined loaded from: /node_modules/sodium-native
Hopefully these tips help.
The easiest way is to just start from the SDK bundle
and work from there.
For the record, I couldn't get the webpack
way working for the life of me. I gave up and switched to Browserify + Babelify.
and I have this error in the console:
Uncaught Error: No native build was found for platform=browser arch=javascript runtime=node abi=undefined uv= libc=glibc node=undefined loaded from: /node_modules/sodium-native
You need to alias the sodium code, see the babel.config.json for how it's done with babel/babelify
Okay, I will try to learn babel :/
Looking into this now. 😁 At the very least it should be building the bundle out of the box.
Try the latest Master branch or v2.8.0. I removed the geut sodum-js fork since apparently sodium-javascript should be working correctly now.
The updated README is good! Thanks for all the help!
index.js is simply
const SDK = require('dat-sdk')
In my terminal:
So I tried
npm install babelify
then, again,browserify index.js > bundle.js
My terminal: