Closed bmatusiak closed 2 years ago
here is the full console output of this build
bmatusiak@bmatusiak-VirtualBox:~/workspace/GUN-EXP/gun/examples/webpack$ npm install
> webpack@1.0.0 prepare
> npm run build
> webpack@1.0.0 build
> webpack --devtool source-map --config webpack.config.js
webpack config loaded
asset ./app.js 100 KiB [emitted] (name: main) 1 related asset
asset ./index.html 104 bytes [emitted]
runtime modules 211 bytes 2 modules
cacheable modules 96.9 KiB
./src/app.js 199 bytes [built] [code generated]
./node_modules/gun/browser.js 36 bytes [built] [code generated]
./node_modules/gun/gun.js 96.6 KiB [built] [code generated]
./node_modules/gun/ sync 160 bytes [built] [code generated]
WARNING in ./node_modules/gun/gun.js 5:16-28
Critical dependency: the request of a dependency is an expression
@ ./node_modules/gun/browser.js 1:0-36
@ ./src/app.js 3:14-28
1 warning has detailed information that is not shown.
Use 'stats.errorDetails: true' resp. '--stats-error-details' to show it.
webpack 5.72.1 compiled with 1 warning in 981 ms
up to date, audited 171 packages in 5s
27 packages are looking for funding
run `npm fund` for details
found 0 vulnerabilities
bmatusiak@bmatusiak-VirtualBox:~/workspace/GUN-EXP/gun/examples/webpack$
so it does WARN, just letting you know its not standard to do the request of a dependency is an expression
but it still includes it normally as it should.
and it I guess it loads package.json->browser
as main
./node_modules/gun/browser.js 36 bytes [built] [code generated]
as for ES6 style loading.. this needs to be looked at a tiny bit more.
this works as app.js
import Gun from 'gun';
var gun = new Gun();
gun.get("hello").get("world").put("from gun").on((data, key) => console.log(data, key));
And there is nothing special about this.. more as a test of webpack loading
however i did notice that if i set in package.json.. gun : file://../../. it failed the webpack build..
https://github.com/amark/gun/blob/master/examples/webpack/package.json#L12
so first rule is package folder locations in package.json
🔥 🔥 ❤️ ❤️ ⚡ ⚡ 🎉 🎉 THANK YOU THANK YOU... webpack, the bane of my existence.
What really? This is it? I still don't understand why this setup (I'm guessing) won't complain about bundling GUN because of NodeJS dependencies (that I've repeatedly for years tried to get webpack to ignore automatically, successfully, until every 6 months later they do something to screw with it) or "expressions"?
You didn't even need to do require
gun/gun
which typically is necessary. And the config doesn't look like it does anything special either. How'd you get it to compile without complaining?Is there any way we can tell webpack in a parent project that depends on gun to look for this webpack config automatically?
Merging. Thank you!