marko-js / language-server

Marko autocomplete, intellisense and editor support.
MIT License
38 stars 8 forks source link

feat: add .js extension for mtc output #241

Closed DylanPiercey closed 6 months ago

DylanPiercey commented 6 months ago

Description

When using @marko/type-check to emit js files for a native es module package the output files will not have the resolved extension included for relative imports.

This is actually a TypeScript design that they say is working as intended: https://www.typescriptlang.org/docs/handbook/modules/theory.html#module-specifiers-are-not-transformed

However besides being very strange to import non existing .js files, it also doesn't work in jest, vite, vitest, webpack, rollup, or esbuild.

So this PR handles it for you. With this change .js extensions are automatically added to output relative import paths.

changeset-bot[bot] commented 6 months ago

🦋 Changeset detected

Latest commit: d4d433f89a76bb80b0b0223cc98262d2fd210a90

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 2 packages | Name | Type | | --------------------- | ----- | | @marko/language-tools | Minor | | @marko/type-check | Minor |

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR