matthew-andrews / isomorphic-fetch

Isomorphic WHATWG Fetch API, for Node & Browserify
MIT License
6.95k stars 289 forks source link

Use same dependency name across the bower and npm files #156

Closed JakeChampion closed 5 years ago

JakeChampion commented 6 years ago

Isomorphic fetch uses different dependencies when installed via npm vs bower. Installing via npm will install whatwg-fetch. Installing via bower will install fetch.

When building the bundle using a webpack configuration which will use bower.json over package.json, webpack will find the bower.json file for isomorphic-fetch and use the file referenced in the main field (fetch-bower) and use that as the file to bundle. fetch-bower is expecting a dependency named fetch to exist but it does not, the name of the dependency that was installed is whatwg-fetch.

We can avoid this situation by aliasing the bower dependency to whatwg-fetch, which is the same name as the dependency that gets installed via npm.