TypeError: Unknown file extension ".ts"
- Dominant language
- JavaScript
- Stars
- 32.9k
- Forks
- 4.1k
- PR merge metrics
- No merged PRs in 30d
Description
Before you open this issue, please complete the following tasks:
* [x] use the search bar at the top of the page to search this repository for similar issues or discussions that have already been opened.
* [x] if you are looking for help from the gulp team or community, open a [discussion](https://github.com/gulpjs/gulp/discussions).
* [x] if you think there is a problem with the plugin you're using, open a [discussion](https://github.com/gulpjs/gulp/discussions).
* [x] if you think there is a bug in our code, open this issue.
### What were you expecting to happen?
gulpfile.ts should be able to import packages written in ESM, like [del@7](https://www.npmjs.com/package/del)
### 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
```cmd
>gulp clean
[19:39:16] Loaded external module: ts-node/register
TypeError: Unknown file extension ".ts" for C:\Users\yuki\Desktop\test-gulp\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:396:7)
at async ModuleLoader.moduleProvider (node:internal/modules/esm/loader:278:45)
at async link (node:internal/modules/esm/module_job:78:21) {
code: 'ERR_UNKNOWN_FILE_EXTENSION'
}
```
### Please provide the following information:
* OS & version [e.g. MacOS Catalina 10.15.4]: Windows 10
* node version (run `node -v`): v20.14.0
* npm version (run `npm -v`): 10.7.0
* gulp version (run `gulp -v`): 5.0.0
### Additional information
Contributor guide
Assessment
This issue has not been assessed yet.