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

Breaking change for file paths in recent npm compatibility update #477

Closed
donovanglover opened this issue May 2, 2024 · 5 comments · Fixed by #493
Closed

Breaking change for file paths in recent npm compatibility update #477

donovanglover opened this issue May 2, 2024 · 5 comments · Fixed by #493
Labels
bug Something isn't working

Comments

@donovanglover
Copy link

The recent PR #463 causes __dirname to include ./_dist, breaking packages that depend on files relative to __dirname.

For example, join(__dirname, '../schemes') will resolve to ./schemes in _jsr_revision 8 and ./_dist/schemes in 10.

Related: #462

@lucacasonato lucacasonato added the bug Something isn't working label May 6, 2024
@lucacasonato
Copy link
Member

How are you doing this in the first place? __dirname does not exist in ESM.

@marvinhagemeister
Copy link
Contributor

Maybe through import.meta.dirname?

@donovanglover
Copy link
Author

Will try making a new release later today with import.meta.dirname. Had to add "type": "module" to package.json and add a mock for ts-jest.

@lucacasonato
Copy link
Member

I think you'll run into the same issue - I'll look into if there is anything we can do here to fix this

@lucacasonato
Copy link
Member

@donovanglover We're going to update the emit to emit the .js files next to the .ts files directly, and only place the .d.ts files in a separate _dist folder.

github-merge-queue bot pushed a commit that referenced this issue May 8, 2024
Some relative specifiers were being incorrectly emitted when referencing
a `.js`
file from a `.d.ts` file in the dist folder.

Additionally, `.js` files were previously emitted into a `_dist` folder,
which
broke users that need to relatively access files in the NPM package
using
`import.meta.url` or similar. Now only `.d.ts` files are emitted into
the
`_dist` folder.

Fixes #491
Fixes #477
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
Status: Done
Development

Successfully merging a pull request may close this issue.

3 participants