Feature request
Using tsx it’s possible to write import … from './index.js'. It’s ok if index.js doesn’t exist, but only index.ts. It will just resolve to that.
If package.json contains an exports field, it’s valid to import the package by name instead of by a path reference.
For example, after compilation of https://github.com/remcohaszing/remark-mdx-frontmatter, it’s valid to rewrite the compiled test to use import remarkMdxFrontmatter from 'remark-mdx-frontmatter' in test.ts. This won’t work without compiling first.
I suggest to make tsx use the same logic for aliasing .js → .ts after resolving package.json exports as it does for relative imports.
Why?
- When testing the public interface, tests closer match how a user would use a package.
- This allows to use
tsx for importing other local packages inside a mono repo.
Alternatives
N/A
Additional context
No response
Feature request
Using
tsxit’s possible to writeimport … from './index.js'. It’s ok ifindex.jsdoesn’t exist, but onlyindex.ts. It will just resolve to that.If
package.jsoncontains anexportsfield, it’s valid to import the package by name instead of by a path reference.For example, after compilation of https://github.com/remcohaszing/remark-mdx-frontmatter, it’s valid to rewrite the compiled test to use
import remarkMdxFrontmatter from 'remark-mdx-frontmatter'intest.ts. This won’t work without compiling first.I suggest to make
tsxuse the same logic for aliasing.js→.tsafter resolvingpackage.jsonexports as it does for relative imports.Why?
tsxfor importing other local packages inside a mono repo.Alternatives
N/A
Additional context
No response