Open khludenevav opened 6 months ago
ESM support for plugins is tracked here: #15682, no ETA on that. We could look into typescript for the tasks runner though, could be interesting.
Temporary solution, add a script to your package.json to compile it from TS to JS and commit:
"scripts": {
"build:custom-runner": "tsc tools/task-runners/custom-runner/index.ts",
@khludenevav you can register runtime ts transpiler(ts-node or swc) via index.js like
require('ts-node').register({ /* options */ });
module.exports = require('./src/index.ts');
Description
I'm using custom tasks runner in order to customize cache. And it works fine, but I see 2 issues 1) it only supports cjs modules. Because uses
require
import.2) I don't want to publish my plugin for my perspective it should be local. Could Nx support executor written on TS?
How I currently reference plugin in nx.json
libs/nx-task-runner/package.json content:
Motivation
Publishing task runner package is additional step and slows down the process of making any changes in it.
Suggested Implementation
Probably somehow using ts-node will help to launch code from ts package.
Alternate Implementations
¯\(ツ)/¯