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

fix(esm): add .js extension to imports #75

Merged
merged 1 commit into from
Jul 13, 2024
Merged

Conversation

omichelsen
Copy link
Owner

@omichelsen omichelsen commented Jul 13, 2024

This will output ESM valid imports.

However this also breaks unit testing as c8/mocha does not understand .js and is expecting .ts.

Fix: ts-node has experimentalResolver setting to map .js > .ts

This will output ESM valid imports.
@coveralls
Copy link

Coverage Status

coverage: 100.0%. remained the same
when pulling ac6ff6c on esm-js-extension
into da8ee8a on main.

@omichelsen omichelsen merged commit e10de90 into main Jul 13, 2024
2 checks passed
@omichelsen omichelsen deleted the esm-js-extension branch July 13, 2024 14:48
@pavle-goloskokovic
Copy link

This will output ESM valid imports.

However this also breaks unit testing as c8/mocha does not understand .js and is expecting .ts.

Using .js instead of .ts also creates issues when trying to import typescript source files directly into project instead of .js build.

Broken unit tests were a good indicator that this is not the proper way to solve the initial problem.

Hopefully you can find a proper solution that does not require the use of experimental features, and also allow again direct use of typescript sources in projects.

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