Closed glowkeeper closed 2 years ago
Me bad - I didn't see the webpack
stuff. With the config' below added, things are much better (aliasing util
gave a whole bunch of other errors):
resolve: {
alias: {
fs: 'graceful-fs',
hyperswarm: 'hyperswarm-web'
}
However, I still get this:
WARNING in ./node_modules/sodium-javascript/randombytes.js 23:6-13
Critical dependency: require function is used in a way in which dependencies cannot be statically extracted
@ ./node_modules/sodium-javascript/index.js
@ ./node_modules/sodium-universal/index.js
@ ./node_modules/hypercore-crypto/index.js
@ ./node_modules/dat-sdk/index.js
@ ./src/containers/pages/settings.tsx
@ ./src/containers/pages/index.ts
@ ./src/components/content.tsx
@ ./src/components/pages/main.tsx
@ ./src/components/root.tsx
@ ./src/components/index.tsx
@ multi @babel/polyfill ./src/components/index.tsx
ERROR in ./node_modules/sodium-javascript/memory.js
Module not found: Error: Can't resolve 'worker_threads' in '/Users/sh601/gitRepos/Storefront-minima/node_modules/sodium-javascript'
@ ./node_modules/sodium-javascript/memory.js 3:50-80
@ ./node_modules/sodium-javascript/index.js
@ ./node_modules/sodium-universal/index.js
@ ./node_modules/hypercore-crypto/index.js
@ ./node_modules/dat-sdk/index.js
@ ./src/containers/pages/settings.tsx
@ ./src/containers/pages/index.ts
@ ./src/components/content.tsx
@ ./src/components/pages/main.tsx
@ ./src/components/root.tsx
@ ./src/components/index.tsx
@ multi @babel/polyfill ./src/components/index.tsx
Trawling around google, I think that's a webpack
issue, too, but I can't find a fix - if and when I do, I'll post an update...
Managed to get it to build by hacking a couple of files in node-modules/sodium-javascript:
In memory.js
, I commented out if (MessageChannel == null) ({ MessageChannel } = require('worker' + '_threads'))
on line 3.
And in randombytes.js
, I commented out if (require != null) {
(and its associated curly brace) on line 23.
Hmmm - I know that's not a long term solution, and I dunno if I've broken anything. I'll keep you posted ;)
I've updated the same issue on sodium-javascript: worker_threads dependency breaks on Node 10
The build instructions and dependencies have changed a bit since this was opened, so it should be working now.
node v14.15.0 npm 6.14.8
I've tried
npm install --save dat-sdk
andnpm install --save dat-sdk@next @geut/sodium-javascript-plus hyperswarm-web
, but both give dependency errors on my build:I was going to try and fix those dependencies myself, but dgram reckons it's been deprecated (without telling me for what), so that made me a bit nervous. Besides, I thought you might like to know about the errors!
What to do? Any help appreciated...