gulpjs / gulpjs/rechoir

Support for esm.ts using `node --loader ts-node/esm`

Open
#43 17 comments 3 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
48
Forks
12
PR merge metrics
No merged PRs in 30d

Description

I use ts for my gulpfile, but some of the plugins i use (gulp-imagemin specifically), are esm.
So having a way to use both would be useful, as otherwise when one tries to run gulp, they get something like this:
```
[18:15:57] Requiring external module ts-node/register
TypeError: Unknown file extension ".ts" for /home/monyarm/Documents/gulp-gameoptimizer/gulpfile.ts
at new NodeError (node:internal/errors:371:5)
at Loader.defaultGetFormat [as _getFormat] (node:internal/modules/esm/get_format:71:15)
at Loader.getFormat (node:internal/modules/esm/loader:105:42)
at Loader.getModuleJob (node:internal/modules/esm/loader:243:31)
at processTicksAndRejections (node:internal/process/task_queues:96:5)
at Loader.import (node:internal/modules/esm/loader:177:17)
at importModuleDynamicallyWrapper (node:internal/vm/module:437:15) {
code: 'ERR_UNKNOWN_FILE_EXTENSION'
}
```

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by reproducing the reported failure with a TypeScript gulpfile, an ESM plugin such as gulp-imagemin, and `node --loader ts-node/esm`. Trace how rechoir prepares modules with different extensions; done means a TypeScript gulpfile can use ESM plugins without the shown unknown-file-extension error.

Written by the indexing model from the issue text.

Assessment

Tech stack
node.js, typescript
Domain
tooling
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.