Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ESModule Support #10744

Open
achrinza opened this issue Nov 17, 2024 · 0 comments
Open

ESModule Support #10744

achrinza opened this issue Nov 17, 2024 · 0 comments

Comments

@achrinza
Copy link
Member

achrinza commented Nov 17, 2024

Packages that need to be updated to support ESModules:

  • @loopback/boot
  • @loopback/build
  • @loopback/cli
  • examples/*

The path to supporting ESModules can be broken down into three stages:

  1. Second-class support for ESModules: Projects should be able to switch over to ESModule by simply setting type: module in package.json
  2. First-class support for ESModules: lb4 commands should detect and generate ESModule artifacts
  3. Default to ESModules: Use ESModules in examples/ and default lb4 app CLI to generating ESModule-based LB4 project

Similar to action-based sequences, we should not drop support for CommonJS entirely, but instead indefinitely deprecate it by the end of stage 3. This means continuing to generate CommonJS @loopback/* packages.

achrinza added a commit that referenced this issue Nov 17, 2024
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: #10744
Signed-off-by: Rifa Achrinza <[email protected]>
achrinza added a commit that referenced this issue Nov 17, 2024
achrinza added a commit that referenced this issue Nov 17, 2024
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: #10744
Signed-off-by: Rifa Achrinza <[email protected]>
achrinza added a commit that referenced this issue Nov 17, 2024
BREAKING CHANGE: `loadClassesFromFiles` now returns a `Promise`

see: #10744
Signed-off-by: Rifa Achrinza <[email protected]>
achrinza added a commit that referenced this issue Nov 17, 2024
BREAKING CHANGE: `loadClassesFromFiles` now returns a `Promise`

see: #10744
Signed-off-by: Rifa Achrinza <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant