You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Throws an error that require() of ES modules is not supported.
Please give us a sample of your gulpfile
importgulpfrom‘gulp';
gulp.task(function(){});
Terminal output / screenshots
require() of /../../gulpfile.js from /../../node_modules/gulp-cli/lib/versioned/^4.0.0/index.js is an ES module file as it is a .js file whose nearest parent package.json contains "type": "module" which defines all .js files in that package scope as ES modules.
Please provide the following information:
OS & version [e.g. MacOS Catalina 10.15.4]: MacOS Catalina 10.15.3
node version (run node -v): v14.2.0
npm version (run npm -v): 6.14.4
gulp version (run gulp -v): CLI: 3.9.1, local: 4.0.2
Additional information
I'm not sure if this is actually a bug report or rather a feature request since the ESM functionality is quite recent in nodejs. I know that I can use "import" statements by renaming the gulpfile.js to gulpfile.babel.js but I think it would be nice if it where possible to use imports natively now since node introduced the ESM functionality.
Is this something that would be possible with the current implementation of gulp?
The text was updated successfully, but these errors were encountered:
Thanks for opening this report, but yeah, it falls under a feature request.
Unfortunately, this requires a massive rewrite of everything because only an esm module can import an esm module. We are tracking this work at gulpjs/interpret#65.
I'll keep this open but lock it so the discussion can happen over there.
phated
changed the title
Use gulp as ESM module
[Feature Request] Use gulp as ESM module
May 19, 2020
Good news! With some amazing work by @snoack in gulpjs/gulp-cli#214, gulp-cli version 2.3.0 has support for loading ESM modules with the .mjs extension!
What were you expecting to happen?
Run/Use gulp in a "type":"module" context
What actually happened?
Throws an error that
require() of ES modules is not supported.
Please give us a sample of your gulpfile
Terminal output / screenshots
Please provide the following information:
node -v
): v14.2.0npm -v
): 6.14.4gulp -v
): CLI: 3.9.1, local: 4.0.2Additional information
I'm not sure if this is actually a bug report or rather a feature request since the ESM functionality is quite recent in nodejs. I know that I can use "import" statements by renaming the
gulpfile.js
togulpfile.babel.js
but I think it would be nice if it where possible to use imports natively now since node introduced the ESM functionality.Is this something that would be possible with the current implementation of gulp?
The text was updated successfully, but these errors were encountered: