From 43f5d83f78ee48f26ad2d6cf78c47b2e7f703d9a Mon Sep 17 00:00:00 2001 From: Rifa Achrinza <25147899+achrinza@users.noreply.github.com> Date: Sun, 17 Nov 2024 19:46:08 +0800 Subject: [PATCH] feat(build): support hybrid CJS/ESM setups BREAKING CHANGE: This changes TypeScript's default behaviour away from forcing CommonsJS mode, and to support generatng ESM files in accordance with Node.js' algorithm Projects may be affected if you use `lb-tsc` and/or extend `tsconfig.*.json` from `@loopback/build`, and: - have `type: module` in `package.json`, or - have `.mts` files, or - use `import()`s (regardless if file ext. is `.ts`/`.mts`/`.cts`) see: https://www.typescriptlang.org/tsconfig/#moduleResolution see: https://github.com/loopbackio/loopback-next/issues/10744 Signed-off-by: Rifa Achrinza <25147899+achrinza@users.noreply.github.com> --- packages/build/config/tsconfig.common.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/build/config/tsconfig.common.json b/packages/build/config/tsconfig.common.json index 8d69c2baae2a..75710e4a6947 100644 --- a/packages/build/config/tsconfig.common.json +++ b/packages/build/config/tsconfig.common.json @@ -16,9 +16,9 @@ "incremental": true, "lib": ["es2020"], - "module": "commonjs", + "module": "node16", "esModuleInterop": true, - "moduleResolution": "node", + "moduleResolution": "node16", "target": "es2018", "sourceMap": true, "declaration": true,