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

Document ts-node moduleTypes #22

Closed
wants to merge 1 commit into from
Closed

Document ts-node moduleTypes #22

wants to merge 1 commit into from

Conversation

karlhorky
Copy link
Contributor

Hi @lukeed 👋 Hope you are well.

A quick PR to document the new moduleTypes module type overrides for authors who are writing the rest of their package in ESM via "type": "module"

@codecov-commenter
Copy link

Codecov Report

Merging #22 (38822cb) into master (3c290b7) will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff           @@
##           master      #22   +/-   ##
=======================================
  Coverage   50.00%   50.00%           
=======================================
  Files           2        2           
  Lines         206      206           
=======================================
  Hits          103      103           
  Misses        103      103           

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 3c290b7...38822cb. Read the comment docs.

@karlhorky
Copy link
Contributor Author

karlhorky commented Jul 28, 2021

Without this change, it seems that ts-node doesn't transform the TS files to CommonJS, which Ley requires

Error [ERR_REQUIRE_ESM]: Must use import to load ES Module: /Users/j/c/packages/l/migrations/1619435929-create-courses-table.ts
    require() of ES modules is not supported.
    require() of /Users/j/c/packages/l/migrations/1619435929-create-courses-table.ts from /Users/j/c/node_modules/ley/lib/util.js is an ES module file as it is a .ts file whose nearest parent package.json contains "type": "module" which defines all .ts files in that package scope as ES modules.

@karlhorky karlhorky mentioned this pull request Oct 22, 2021
@lukeed lukeed closed this in #23 Oct 22, 2021
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.

3 participants