rhodey / radiowitness

P25 public safety radio archive with Dat Protocol authenticated mirrors.
http://radiowitness.org
8 stars 2 forks source link

web app build failing #2

Closed rhodey closed 3 years ago

rhodey commented 3 years ago

The web app used to be built with bankai which makes use of browserify. sodium-universal has a bug and is a dependency of hypercore and hyperdb.

rhodey commented 3 years ago

I was able to temporarily workaround the "Cannot find module ./crypto_auth" bug by pinning hypercore's hypercore-crypto dependency to v2.1.0:

https://github.com/rhodey/radiowitness/commit/b05f650cf8d5ed3cb3d51f8984f788e1c0245975#diff-b861012a5dd72b8a9f3281b7cf09f5a779c98569d040b1bbc1db50f1b15e7cceR22

Moving onward I have uncovered two more issues, the first is that I cannot manage to get bankai and babel working together in order to deal with this use of the JavaScript spread operator in hypercore:

opts = { ...opts } https://github.com/hypercore-protocol/hypercore/blob/master/index.js#L1265

After rewriting that one line to use Object.assign() the bankai start command succeeds and I am able to test the web app using localhost 8080, unfortunately bankai build fails to bundle the app with the following error:

scripts:browserify.bundle Can't walk dependency graph: ENOENT: no such file or directory, lstat '/home/rhodey/dev/dsp/radiowitness/web/worker_threads'
    required by /home/rhodey/dev/dsp/radiowitness/web/node_modules/sodium-universal/memory.js
Error: Can't walk dependency graph: ENOENT: no such file or directory, lstat '/home/rhodey/dev/dsp/radiowitness/web/worker_threads'
    required by /home/rhodey/dev/dsp/radiowitness/web/node_modules/sodium-universal/memory.js

This is unexpected because sodium-javascript appears to be using the package.json "browser" tag correctly to omit worker_threads from browser bundling:

"browser": {
    "crypto": false,
    "worker_threads": false
}

https://github.com/sodium-friends/sodium-javascript/blob/master/package.json#L28

So, two things to track down:

  1. bankai with babel-plugin-transform-object-rest-spread?
  2. bankai not respecting "browser" tag?
rhodey commented 3 years ago

abandoned bankai for browserify + watchify, web app building again.

https://github.com/rhodey/radiowitness/commit/89327d1dea08228bd138656bacb8ff22a429f9c8