Skip to content
This repository was archived by the owner on Jan 27, 2026. It is now read-only.

Commit 701b93c

Browse files
authored
fix(cli): cater for new potential error (#2666)
This change updates the existing condition where the CLI caters for when a package main script points to a .ts file. This addresses an update to the default behavior for how modules are handled by `require`. Signed-off-by: Stan Lewis <gashcrumb@gmail.com>
1 parent 2ed56c0 commit 701b93c

File tree

2 files changed

+10
-3
lines changed

2 files changed

+10
-3
lines changed

.changeset/purple-rabbits-roll.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@janus-idp/cli": patch
3+
---
4+
5+
This change updates the CLI to cater for the way modules are handled by `require` in node v20.19.0, which fixes an error that can be thrown by the CLI when an es6 or typescript module is picked up by `require`.

packages/cli/src/commands/export-dynamic-plugin/backend.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -858,10 +858,12 @@ function validatePluginEntryPoints(target: string): string {
858858
try {
859859
return dynamicPluginRequire(modulePath);
860860
} catch (e) {
861-
// Retry only if we failed with SyntaxError because the `ts` require extension was not there.
862-
// Else we should throw.
861+
// Retry only if we failed with SyntaxError or unsupported dir format
862+
// because the `ts` require extension was not there. Else we should
863+
// throw.
863864
if (
864-
e?.name !== SyntaxError.name ||
865+
(e?.code !== 'ERR_UNSUPPORTED_DIR_IMPORT' &&
866+
e?.name !== SyntaxError.name) ||
865867
dynamicPluginRequire.extensions['.ts'] !== undefined
866868
) {
867869
throw e;

0 commit comments

Comments
 (0)