Is it possible to replace gulpfile.js & use ES Modules together? #2669
Unanswered
latushko-igor
asked this question in
Help
Replies: 1 comment 1 reply
-
I'm trying to same thing. |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Hi.
I am trying to replase
gulpfile.js
how it described in docs and use ES6 import/export together.I put my
gulpfile.js
in/gulpfile.js
directory and rename it toindex.js
. Then add"type": "module"
inpackage.json
. And when i am startgulp
i am get an errorError [ERR_MODULE_NOT_FOUND]: Cannot find module 'e:\..\gulpfile.js
.Ok, then i run
gulp --gulpfile './gulpfile.js/index.js'
and get another errorReferenceError: exports is not defined
pointed to stringexports.default = taskName
in my./gulpfile.js/index.js
.Is it possible to use together ES Modules and placed gulpfile in separate directory?
UPD: A solution is
export default taskName;
instead ofexports.default = taskName
Beta Was this translation helpful? Give feedback.
All reactions