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
The esm loader stuff was immature while we developed the underpinnings to gulp v5, but we plan to explore some different techniques for gulp v6 (which drops older node support).
Currently, transpiling is likely your best option to use a different language+ESM (like you mentioned).
Is it possible to tell gulp to run npx tsc -p tsconfig.gulp.json before it locate the local gulpfile.js and do its work?
I have to do something like this npx tsc -p tsconfig.gulp.json && gulp build currently, which is pretty tedious.
Until ESM loader is better supported in future ts-node, you can add this snippet into tsconfig.json. Gulp should work "transparently" now without a pre-transpile step or an additional tsconfig file.
Activity
UchihaYuki commentedon Jun 20, 2024
It seems tsx will work, but I don't know how to replace
ts-nodewithtsx. Haven't found any doc online.UchihaYuki commentedon Jun 20, 2024
https://www.youtube.com/watch?v=jn370WEIvjs
TypeStrong/ts-node#1997
UchihaYuki commentedon Jun 20, 2024
This seems a pretty complicated issue around running typescript on node.
I'm going to transpile gulpfile.ts to js first as a workaround now.
phated commentedon Jun 20, 2024
The esm loader stuff was immature while we developed the underpinnings to gulp v5, but we plan to explore some different techniques for gulp v6 (which drops older node support).
Currently, transpiling is likely your best option to use a different language+ESM (like you mentioned).
UchihaYuki commentedon Jun 21, 2024
Is it possible to tell gulp to run
npx tsc -p tsconfig.gulp.jsonbefore it locate the local gulpfile.js and do its work?I have to do something like this
npx tsc -p tsconfig.gulp.json && gulp buildcurrently, which is pretty tedious.phated commentedon Jun 25, 2024
You might be able to do something with
--preloadand then embed the extra flags in a.gulp.jsconfig file, but I'm not sure what that would look like.folliehiyuki commentedon Dec 27, 2024
Until ESM loader is better supported in future
ts-node, you can add this snippet intotsconfig.json. Gulp should work "transparently" now without a pre-transpile step or an additional tsconfig file.Tmaof commentedon May 25, 2025
你可以这样配置脚本来暂时解决这个问题:
"start": "gulp --require tsx/dist/loader.cjs -f gulpfile.ts",记得安装tsx依赖,参考:https://github.com/element-plus/element-plus/blob/dev/internal/build/package.jsonTmaof commentedon May 25, 2025
You can configure the script to solve this problem temporarily:
"start": "gulp --require tsx/dist/loader.cjs -f gulpfile.ts",remember to install the tsx dependency, Reference: https://github.com/element-plus/element-plus/blob/dev/internal/build/package.json