-
Notifications
You must be signed in to change notification settings - Fork 62
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
fix: only require http api client if it has not been specified #450
fix: only require http api client if it has not been specified #450
Conversation
2a6f984
to
d4082db
Compare
If we configure which http api module to use, don't try to require `ipfs-http-client`, because that then means the containing project needs to specify a dependency on `ipfs-http-client` when the containing project might actually be `ipfs-http-client`...
d4082db
to
3a0f870
Compare
hummm why did this jumped +9kb in size |
Transitive dependencies changed? |
No idea why this is necessary
its 9kb gziped would need a lot random stuff from deps, can you run the aegir build analize please ? just to double check theses changes dont make us include http-client twice |
We shouldn't really be including I ran the analyser - it's quite hard to make out what's going on, they're definitely in there though only once that I can see. Before: After: I've added them to webpack's externals list so they don't get added to the bundle. Not sure if that's going to make the browser version explode at runtime or not. |
its gonna break browser tests please remove the last commit and lets merge/release this. tip: use chrome to see the analyser, for some reason brave is broken. |
9970cf7
to
43e01d8
Compare
Co-Authored-By: Hugo Dias <[email protected]>
src/factory.js
Outdated
if (options.ipfsModule) { | ||
delete opts.ipfsModule | ||
|
||
if (options.ipfsModule.path) { | ||
opts.ipfsModule = { | ||
path: options.ipfsModule.path | ||
// n.b. no ref property - do not send code refs over http | ||
} | ||
} | ||
} | ||
|
||
if (options.ipfsHttpModule) { | ||
delete opts.ipfsHttpModule | ||
|
||
if (options.ipfsHttpModule.path) { | ||
opts.ipfsHttpModule = { | ||
path: options.ipfsHttpModule.path | ||
// n.b. no ref property - do not send code refs over http | ||
} | ||
} | ||
} |
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.
why do we need all this haven't we already done this below? we just need to remove refs like in the previous version of this block.
Plus its deleting and setting opts.ipfsModule where it should be opts.json.ipfsModule and same for opts.ipfsHttpModule, so if this code made some use case work it wasn't because of this logic.
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.
It was resulting in ipfsModule: {}
being sent over the http api which was then getting fleshed out to ipfsModule: { path: require.resolve('ipfs'), ref: require('ipfs') }
which breaks under js-ipfs
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.
these if clauses are very hard to track and error prone because of all the combinations available in ctl
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.
Fair point about the deletion of the wrong property though.
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.
these if clauses are very hard to track and error prone because of all the combinations available in ctl
You are quite right. Here, look - I've removed them: #454
If we configure which http api module to use, don't try to require
ipfs-http-client
, because that then means the containing project needs to specify a dependency onipfs-http-client
when the containing project might actually beipfs-http-client
...