Skip to content
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

Alias node-fetch #1335

Open
ptbrowne opened this issue Jul 22, 2020 · 0 comments
Open

Alias node-fetch #1335

ptbrowne opened this issue Jul 22, 2020 · 0 comments

Comments

@ptbrowne
Copy link
Contributor

node-fetch can be used to provide the fetch function to services.

Recently, it introduced a "module" entrypoint that is used by webpack when webpack's target is node.

  "main": "lib/index",
  "browser": "./browser.js",
  "module": "lib/index.mjs",

Since the mjs is prior to js in webpack's default resolve.extensions, the module is used in priority.

It caused problems in banks since the result of the require was a "module" object with a default property. Other libs (like isomorphic-fetch) rely on the result of require('node-fetch') to be the fetch function.

This is why in banks, the resolve was forced to use lib/index.js. See https://github.com/cozy/cozy-banks/blob/e6bc4fdc762031300de393811a03dd926c878a89/config/webpack.target.services.js#L90.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant