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

[Node.js 23.x] CJS module gulp-cli\lib\shared\require-or-import.js is loading ESM gulpfile.js using require() #267

Open
4 tasks done
cedx opened this issue Oct 29, 2024 · 1 comment

Comments

@cedx
Copy link

cedx commented Oct 29, 2024

Before you open this issue, please complete the following tasks:

  • use the search bar at the top of the page to search this repository for similar issues or discussions that have already been opened.
  • if you are looking for help from the gulp team or community, open a discussion.
  • if you think there is a problem with the plugin you're using, open a discussion.
  • if you think there is a bug in our code, open this issue.

What were you expecting to happen?

Launching a Gulp task doesn't produce any warning.

What actually happened?

Since Node.js v23, an ExperimentalWarning is triggered.

This is because the requireOrImport() function uses require() to check if the gulpfile is a CommonJS module... but now Node.js allows to use require() for loading ES modules. So the ERR_REQUIRE_ESM error is not triggered anymore.

See: https://nodejs.org/en/blog/release/v23.0.0

Please give us a sample of your gulpfile

This issue is not related to the content of the gulpfile.
But feel free to test this project: https://github.com/cedx/lcov.js

Terminal output / screenshots

(node:26792) ExperimentalWarning: CommonJS module [...]\gulp-cli\lib\shared\require-or-import.js is loading ES Module [...]\gulpfile.js using require().

Please provide the following information:

  • OS & version [e.g. MacOS Catalina 10.15.4]: Windows 11
  • node version (run node -v): 23.1.0
  • npm version (run npm -v): 10.9.0
  • gulp version (run gulp -v): CLI version: 3.0.0, Local version: 5.0.0

Additional information

The launched tasks still run fine (unless the gulpfile uses top-level await). There is no runtime error, just an ExperimentalWarning.

@jtrumbull
Copy link

Same issue, same environment

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

2 participants