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

A new ESM loader equivalent of 'ts-node/register/transpile-only' #1101

Closed
concision opened this issue Aug 10, 2020 · 2 comments
Closed

A new ESM loader equivalent of 'ts-node/register/transpile-only' #1101

concision opened this issue Aug 10, 2020 · 2 comments

Comments

@concision
Copy link
Contributor

@cspotcode

Continuing the discussion from #1007.


CommonJS has the file shortcut ts-node/register/transpile-only for installing the TypeScript loader without type checking. An ESM loader which has the equivalent functionality should be created and exposed to the end user.

export const {resolve, getFormat, transformSource} = esm.registerAndCreateEsmHooks()

The code from esm.mjs can be duplicated in a new file, but with the transpileOnly flag set:

export const {resolve, getFormat, transformSource} = esm.registerAndCreateEsmHooks({transpileOnly: true})

What should the loader filename look like? There is ts-node/esm.mjs, should it be ts-node/esm/transpile-only.mjs?

@cspotcode
Copy link
Collaborator

ts-node/esm/transpile-only.mjs makes sense to me. A user does node --loader ts-node/esm/transpile-only ./foo.ts

cspotcode pushed a commit that referenced this issue Aug 12, 2020
* Added a transpile-only ESM loader (#1101)

* feat: Added transpile-only ESM loader to package.json exports and resolve tests

* feat: Added success/failure tests for transpile-only ESM loader

* fix: Fix transpile-only ESM loader tests
Fixed ESM tests being executed under node 13.0.0
Fixed error message matching criteria

* fix: Fix erroneous quotations in transpile-only ESM loader tests

* feat: Removed imports on tests for esm-transpile-only tests

* feat: Renamed and restructured esm-transpile-only tests
@concision
Copy link
Contributor Author

Resolved with #1102

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

No branches or pull requests

2 participants