Skip to content

Conversation

@mdonnalley
Copy link
Contributor

Sets moduleResolution to Node16 in tsconfig.json. This allows us to use await import for ESM modules without it getting transpiled to a require

See this discussion for more context.

Fixes #256

@W-138327242@

@mdonnalley mdonnalley force-pushed the mdonnalley/node-16-resolution branch from 123717d to 1efe82e Compare July 28, 2023 16:27
@cristiand391
Copy link
Member

QA notes:

✅ successfully load esm commands and hooks

  1. generate esm cli with init hook
  2. yarn link @oclif/core
  3. DEBUG=config:esm-test-cli,esm-test-cli:esm-test-cli:hooks:init npx ts-node ./bin/dev.js hello world:
    Screenshot 2023-07-31 at 18 08 28

then If I revert the tsconfig change and build oclif/core again:

Screenshot 2023-07-31 at 18 09 54

@cristiand391 cristiand391 merged commit d7fdda8 into main Jul 31, 2023
@cristiand391 cristiand391 deleted the mdonnalley/node-16-resolution branch July 31, 2023 21:11
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.

Use module: node12 in tsconfig.json; supports not transpiling import() / dynamic import for CommonJS code

3 participants