-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Make parity.js usable by Node and Browser #3475
Conversation
Why not just use |
Agreed with @tomusdrw here - just include isomorphic-fetch as part of the entry point (instead of whatwg-fetch) and no other hoops to jump through. (Just webpack lib build needs to include it, which it will) |
So I'm not sure how this library is distributed on NPM... ? I had to do this trick because I thought the built JS file had to work in Node and in a browser |
Hmm, so I thought that |
Well The real solution is to have a proper repo, with a build for browser and a build for Node (or as-is for Node in fact) |
Ok, as discussed, seems it is the best approach. I just want to test the library as built in both a Node & Browser environment before giving the ok. (Don't want to go cowboy and have a broken module on NPM. Will do so first thing in the morning.) |
ci failing? |
@ngotchac Just added the in-progress label since there are issues you are working on in here. |
@jacogr Ok it should be fine now. You can try it with |
entry: 'library.js', | ||
output: { | ||
path: path.join(__dirname, '.npmjs'), | ||
filename: 'library.js', | ||
libraryTarget: 'commonjs' | ||
library: 'Parity', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
s/Parity/parity/, need this to work -
const { Api } = window.parity;
const api = new Api(...);
Fixes #3471