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

[@rollup/plugin-esm-shim] shim is inserted in wrong place #1842

Open
kingyue737 opened this issue Feb 3, 2025 · 1 comment · May be fixed by #1844
Open

[@rollup/plugin-esm-shim] shim is inserted in wrong place #1842

kingyue737 opened this issue Feb 3, 2025 · 1 comment · May be fixed by #1844

Comments

@kingyue737
Copy link

kingyue737 commented Feb 3, 2025

  • Rollup Plugin Name: @rollup/plugin-esm-shim
  • Rollup Plugin Version: 0.1.7
  • Rollup Version: 3.7.5
  • Operating System (or Browser): Both Windows and Linux
  • Node Version: v22.13.1
  • Link to reproduction (⚠️ read below): https://stackblitz.com/edit/rollup-repro-jaaluyfb

Expected Behavior

Shim should be inserted at line 13

Actual Behavior

Shim is inserted at line 29 which causes syntax error

Image

Additional Information

@kingyue737
Copy link
Author

kingyue737 commented Feb 3, 2025

I found the reason for the bug, the imports in comments are also matched by RegExp, so findPositionToInsertShim returns a wrong position

Image

Could we just insert the shim at the top?

@younggglcy younggglcy linked a pull request Feb 10, 2025 that will close this issue
9 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant