Unable to run gulp command when gulpfile.ts is in TypeScript ### Expected Behaviour ``` npx gulp ``` Should build. Pass. ### Actual Behaviour ``` /home/michael-heuberger/code/binarykitchen/videomail.io ❯❯❯ npx gulp feature/typescript ✭ ✱ [15:57:06] Loaded external module: ts-node/register TypeError: Unknown file extension ".ts" for /home/michael-heuberger/code/binarykitchen/videomail.io/gulpfile.ts at Object.getFileProtocolModuleFormat [as file:] (node:internal/modules/esm/get_format:160:9) at defaultGetFormat (node:internal/modules/esm/get_format:203:36) at defaultLoad (node:internal/modules/esm/load:143:22) at async ModuleLoader.load (node:internal/modules/esm/loader:403:7) at async ModuleLoader.moduleProvider (node:internal/modules/esm/loader:285:45) at async link (node:internal/modules/esm/module_job:78:21) { code: 'ERR_UNKNOWN_FILE_EXTENSION' } ``` Gulp's official documentation says it should work, see: https://gulpjs.com/docs/en/getting-started/javascript-and-gulpfiles/ Likewise, your documentation says the same: https://github.com/TypeStrong/ts-node/blob/main/website/docs/recipes/gulp.md?plain=1 ### Specifications * ts-node version: `v10.9.2` * node version: `v20.12.2` * TypeScript version: `5.5.3` * tsconfig.json, if you're using one: ``` { "include": [ "etc", "src", "test", "gulpfile.ts", ".eslintrc.js", "prettier.config.js", "babel.config.js" ], "compilerOptions": { // Required "target": "esnext", "module": "CommonJS", "noEmit": true, "allowImportingTsExtensions": true, "allowArbitraryExtensions": true, "isolatedModules": true, "esModuleInterop": true, "lib": ["dom", "dom.iterable", "esnext"], "skipLibCheck": true, "strict": true, "allowJs": true, "allowSyntheticDefaultImports": true, "allowUnusedLabels": false, "allowUnreachableCode": false, "exactOptionalPropertyTypes": true, "noFallthroughCasesInSwitch": true, "noImplicitOverride": true, "noImplicitReturns": true, "noUncheckedIndexedAccess": true, "noUnusedLocals": true, "noUnusedParameters": true, "noEmitOnError": true, "stripInternal": true, "resolveJsonModule": true, // TODO remove these exceptions and fix more errors one day "noImplicitAny": false } } ``` * Operating system and version: Arch Linux I've tried many different configurations and combinations. All my attempts failed. No idea why it says `.ts` is an unknown extension?
Activity
kooriookami commentedon Jul 19, 2024
I have this problem too. My node version is
v18.19.1.binarykitchen commentedon Jul 19, 2024
Figured out an ugly workaround for now:
kooriookami commentedon Jul 19, 2024
This works, but still ugly.