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

transformer: incorrect sourcemap for multiline imports #9055

Closed
sapphi-red opened this issue Feb 12, 2025 · 4 comments · Fixed by #9064
Closed

transformer: incorrect sourcemap for multiline imports #9055

sapphi-red opened this issue Feb 12, 2025 · 4 comments · Fixed by #9064
Labels
C-bug Category - Bug

Comments

@sapphi-red
Copy link
Contributor

The specifier part isn't mapped correctly.
Image
visualizer
reproduction using transform function exposed from rolldown: https://stackblitz.com/edit/github-xv4yss-hhyuz3j3?file=build.mjs

I used rolldown 2e368ff which uses OXC 0.49.0.
This does not reproduce with rolldown 06372d4 which uses OXC 0.48.2 (visualizer).

I found this when upgrading rolldown in rolldown-vite.

@sapphi-red sapphi-red added the C-bug Category - Bug label Feb 12, 2025
@sapphi-red
Copy link
Contributor Author

sapphi-red commented Feb 12, 2025

It seems it's not only for multiline ones. The sourcemap is incorrect for import depCjs from '@vitejs/test-worker-dep-cjs' as well (
visualizer).
Image
I expect the default export part to be a separate segment.

@hi-ogawa
Copy link
Contributor

It looks like some mapping for StringLiteral isn't emitted when StringLiteral::print is replaced with directly calling print_quoted_utf16 in #8839.

@sapphi-red
Copy link
Contributor Author

Ah, I see. I probably have to call p.add_source_mapping(self.span).

graphite-app bot pushed a commit that referenced this issue Feb 12, 2025
- Closes #9055

I think this particular issue of `ImportDeclaration` is not caught on Rolldown because chunk level `import/export` rendering is not done by oxc codegen.
@overlookmotel
Copy link
Contributor

Fixed in #9064.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category - Bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants