Open UchihaYuki opened 3 months ago
It seems tsx will work, but I don't know how to replace ts-node
with tsx
. Haven't found any doc online.
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.
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.
You might be able to do something with --preload
and then embed the extra flags in a .gulp.js
config file, but I'm not sure what that would look like.
Before you open this issue, please complete the following tasks:
What were you expecting to happen?
gulpfile.ts should be able to import packages written in ESM, like del@7
What actually happened?
[19:28:40] Loaded external module: ts-node/register TypeError: Unknown file extension ".ts" for C:\Users\yuki\Desktop\test-gulp\gulpfile.ts
Please give us a sample of your gulpfile
https://github.com/UchihaYuki/gulp-typescript-bug
Terminal output / screenshots
Please provide the following information:
node -v
): v20.14.0npm -v
): 10.7.0gulp -v
): 5.0.0Additional information