Skip to content

fix: improve npm tarball emit #493

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

Merged
merged 2 commits into from
May 8, 2024
Merged

fix: improve npm tarball emit #493

merged 2 commits into from
May 8, 2024

Conversation

lucacasonato
Copy link
Member

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

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.
let new_specifier = if resolved_specifier.scheme() == "file" {
relative_import_specifier(self.base_specifier, &resolved_specifier)
} else {
resolved_specifier.to_string()
};

if &new_specifier == source_text_specifier {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was happening in the wrong place. If we need to update the specifier because the base specifier is different, we still need to write the updated specifier.

@lucacasonato lucacasonato added this pull request to the merge queue May 8, 2024
Merged via the queue into main with commit 7e28877 May 8, 2024
8 checks passed
@lucacasonato lucacasonato deleted the fix_npm_tarball branch May 8, 2024 16:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants