Skip to content

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

Merged
omichelsen merged 1 commit into
mainfrom
esm-js-extension
Jul 13, 2024
Merged

fix(esm): add .js extension to imports#75
omichelsen merged 1 commit into
mainfrom
esm-js-extension

Conversation

@omichelsen

@omichelsen omichelsen commented Jul 13, 2024

Copy link
Copy Markdown
Owner

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
Copy Markdown

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
@omichelsen omichelsen deleted the esm-js-extension branch July 13, 2024 14:48
@pavle-goloskokovic

Copy link
Copy Markdown

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