New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[WIP] Add ES modules to unbuild process #796
Conversation
@rm-rf-etc excellently done! I'm very impressed! If need be, I can pull this now. :) Your unbuild updates are very clever! Love it!! ++Thanks for the IDK why Travis is complaining? Something about lodash shrinkwrap? Looks like lodash not actually used for any of your changes, can probably just delete it from optionalDeps? |
@amark ya, still WIP. From ESM perspective, there's no import for I haven't inspected the Travis output yet. I'll remove the You're correct, ESM import statements can't be used for property assignment, so this simple change made the output work for both I think a good solution would also evaluate how |
Yeah, I'm all about compatibility. Very important philosophy of mine. We'll have to catch up on the |
I took a look about the esm build. Rollup does not complain anything, that's great, but it seems like many of methods are missing on the Gun's prototype. Happy to see the esm build published! |
👍 Keep me in the loop if you guys need anything. Let me know. |
Don't forget to add a "module" field in the package.json 🧙 |
I know this is languishing. I promise I will come back to it. Currently struggling with webpack in Weir. |
how is that going? |
anybody else able to help with this? |
Any problem on the process? |
@Jack-Works Or do you know of a trick that would let us change the NPM index.js to export safely? That way no browsers touch it, but build tools should. Actually, hold up, does node support exports? my 10.16.3 is crashing on Rob's example also. |
If you specify a "module": "./es-build/index.js", webpack and rollup will respect this setting and import the file from the es-build/index.js It is impossible to support cjs and esmodule and use no import/export declaration at the same time. |
@Jack-Works thanks in the package.json or a webpack.config? |
In your package.json |
hello, any progress on this? |
@Jack-Works could you try specifying "./node_modules/gun/server.js" in your webpack path, at least in node using --experimental-modules flag it imports this correctly and creates a usable version of gun |
@rm-rf-etc: so, whats the problem? you are quite quiet in https://gitter.im/amark/gun recently... |
can someone do a PR for those webpack path thing and package.json thing? Thanks <3 |
I have interest to do this when I'm free |
Opening a PR while still WIP. Wanted to make the diff easy for people to review. Relates to #789
Status
Builds and runs without error.
.on()
appears to work in a quick initial test. No other tests done yet.Testing
https://github.com/rm-rf-etc/webpack-test
Misc
@amark if I change webpack to production mode, the file is 26KB (uncompressed). MacOS says gun.min.js is ~34KB.
So then I tested with closure compiler (here). I just copied the text content into the box and ran it without any changes to the build options.
From master: 12.57KB gzipped (33.19KB uncompressed)
From webpack: 9.95KB gzipped (25.16KB uncompressed)