github-actions-workflow-ts
github-actions-workflow-ts copied to clipboard
Does not work on ESM
I have "type":"module" in my package.json and when I run npx generate-workflow-files build it fails:
[github-actions-workflow-ts] No config (wac.config.json) file found in root dir. Using default config.
[github-actions-workflow-ts] Detected following .wac.ts files:
[github-actions-workflow-ts] --> src/workflows/tests.wac.ts
node_modules/ts-node/dist-raw/node-internal-errors.js:46
const err = new Error(getErrRequireEsmMessage(filename, parentPath, packageJsonPath))
^
Error [ERR_REQUIRE_ESM]: Must use import to load ES Module: src/workflows/tests.wac.ts
require() of ES modules is not supported.
require() of src/workflows/tests.wac.ts from node_modules/github-actions-workflow-ts/build/cli/commands/build.js is an ES module file as it is a .ts file whose nearest parent package.json contains "type": "module" which defines all .ts files in that package scope as ES modules.
Instead change the requiring code to use import(), or remove "type": "module" from package.json.
I've run into this before. Will create a fix for this. Thanks for raising.