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

Fix node-fetch version to ^2.6.11 #29

Merged
merged 2 commits into from
Jul 11, 2023

Conversation

joselcvarela
Copy link
Member

@joselcvarela joselcvarela commented Jul 11, 2023

Motivation

In #26 it was added a feature to retry requests.
This feature depends on node-fetch so it was installed the latest version of this package.
Although version 3.x of node-fetch is ESM only and when trying to run gatsby develop the following error appears:

  Error: [ERR_REQUIRE_ESM]: require() of ES Module /tmp/gatsby-directus/node_modules/.pnpm/[email protected]/node_modules/node-fetch/src/index.js from /private/tmp/gatsby-directus/node_modules/.pn
  pm/@[email protected][email protected][email protected][email protected]/node_modules/@directus/gatsby-source-directus/gatsby-node.js not supported.
  Instead change the require of index.js in /tmp/gatsby-directus/node_modules/.pnpm/@[email protected][email protected][email protected][email protected]
  1.0/node_modules/@directus/gatsby-source-directus/gatsby-node.js to a dynamic import() which is available in all CommonJS modules.

Solution

In #28 there's an attempt to overcome this issue by implementing the dynamic import.
Although, the recommended solution for now should be to follow other packages that we depend on like gatsby or gatsby-source-graphql which are using version ^2.6.11 of node-fetch

Closes #28

@rijkvanzanten rijkvanzanten merged commit eb3c691 into directus:main Jul 11, 2023
@joselcvarela joselcvarela deleted the fix-node-fetch-version branch November 17, 2023 18:58
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

Successfully merging this pull request may close these issues.

2 participants