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

feat(build/booter): support esm #10745

Draft
wants to merge 2 commits into
base: master
Choose a base branch
from
Draft

Conversation

achrinza
Copy link
Member

@achrinza achrinza commented Nov 17, 2024

This PR introduces support for ESModules in @loopback/build and @loopback/boot.

Breaking changes:

  • @loopback/build
    • tsconfig.common.json is updated to support hybrid CommonJS+ESModule packages. This prevents TypeScript from rewriting dynamic import()s into require()s, which is needed by @loopback/boot.
  • @loopback/boot
    • loadClassesFromFiles now returns a Promise

Part of: #10744

Checklist

  • DCO (Developer Certificate of Origin) signed in all commits
  • npm test passes on your machine
  • New tests added or existing tests modified to cover all changes
  • Code conforms with the style guide
  • API Documentation in code was updated
  • Documentation in /docs/site was updated
  • Affected artifact templates in packages/cli were updated
  • Affected example projects in examples/* were updated

👉 Check out how to submit a PR 👈

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 achrinza force-pushed the feat/build-booter-esm branch from 48cd7db to 25846b6 Compare November 17, 2024 13:19
BREAKING CHANGE: `loadClassesFromFiles` now returns a `Promise`

see: #10744
Signed-off-by: Rifa Achrinza <[email protected]>
@achrinza achrinza force-pushed the feat/build-booter-esm branch from 25846b6 to 9b7acd2 Compare November 17, 2024 13:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant