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

Issue: SyntaxError when using @graphql-tools/import with Node.js (v20 or v22) #6225

Open
4 tasks
winverse opened this issue May 31, 2024 · 0 comments
Open
4 tasks

Comments

@winverse
Copy link

winverse commented May 31, 2024

Issue workflow progress

Progress of the issue based on the
Contributor Workflow

  • 1. The issue provides a reproduction available on Github, Stackblitz or CodeSandbox

    Make sure to fork this template and run yarn generate in the terminal.

    Please make sure the GraphQL Tools package versions under package.json matches yours.

  • 2. A failing test has been provided
  • 3. A local solution has been provided
  • 4. A pull request is pending review

Describe the bug

When attempting to run a project that uses @graphql-tools/import, a SyntaxError is thrown indicating that the process module does not provide an export named cwd. This error occurs when importing the cwd function from the process module.

To Reproduce Steps to reproduce the behavior:

Steps to reproduce the behavior:

Set up a project using @graphql-tools/import.
Use Node.js v20.11.1. or v22.2.0
Attempt to run the project.
Observe the following error:

file:/node_modules/.pnpm/@graphql-tools+import@7.0.1_graphql@16.8.1/node_modules/@graphql-tools/import/esm/index.js:3
import { cwd as cwdFactory } from 'process';
              ^^^
SyntaxError: The requested module 'process' does not provide an export named 'cwd'
    at ModuleJob._instantiate (node:internal/modules/esm/module_job:132:21)
    at async ModuleJob.run (node:internal/modules/esm/module_job:214:5)
    at async ModuleLoader.import (node:internal/modules/esm/loader:329:24)
    at async loadESM (node:internal/process/esm_loader:28:7)
    at async handleMainPromise (node:internal/modules/run_main:113:12)

Expected behavior

The project should run without errors, correctly importing and using the cwd function from the process module.

Environment:

  • OS: Mac (Sonoma 14.5)
    @graphql-tools/import: 7.0.1
    NodeJS: v20.11.1

Additional context

It seems like the ESM implementation in Node.js does not support named exports from the process module as expected by @graphql-tools/import. This issue might require changes in how the process module is imported or an update to the @graphql-tools/import package to support the latest Node.js versions.

Thank you for looking into this issue!

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