Skip to content

feat: swc loader support emitAssertForImportAttributes config #9826

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 1 commit into from
Apr 21, 2025

Conversation

fireairforce
Copy link
Contributor

@fireairforce fireairforce commented Mar 28, 2025

Summary

closes: #9780

related issue: swc-project/swc#10286 (comment)

The default behavior of swc will transform import-attributes's keyword from assert to with, in this case, we can use config jsc.experimental.emitAssertForImportAttributes to keep the assert keyword to align the output test case with webpack.

Juat as the playground show:

https://play.swc.rs/?version=1.11.13&code=H4sIAAAAAAAAA8vMLcgvKlEoSEzOTkxP9Qr291NIK8rPVVDS04eK6WUV5%2BcpKSQWF6cCFVaXVBakWikogQVrrbmS8%2FOK83NS9XLy0zWQDNG0BgDW5p%2FHWQAAAA%3D%3D&config=H4sIAAAAAAAAA0WPMQ7CMAxF954i8twBdWBgY0Fi4BChWCjQNJHtSK2q3B23Tcpmfz9%2Ffy%2BNMfDhHi5m0VKbaImRjl4Vnkexkyogc0TuyUWBbZjbfUcsvVFWArk7dR0UHaeI5Dzq%2FrA6mmr5RYx3HwPJlfWauDCyAkIJ28qgd2V6C1RgEXLPJFjhwuamZAEfXmnA%2Fzdr4j3XGQ7I8aNim0lufpUNp%2B0HAQAA

Checklist

  • Tests updated (or not required).
  • Documentation updated (or not required).

@github-actions github-actions bot added the release: bug fix release: bug related release(mr only) label Mar 28, 2025
Copy link

netlify bot commented Mar 28, 2025

Deploy Preview for rspack ready!

Name Link
🔨 Latest commit 38e87aa
🔍 Latest deploy log https://app.netlify.com/sites/rspack/deploys/6805d5b3bb2dc40008dd7ce2
😎 Deploy Preview https://deploy-preview-9826--rspack.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

Copy link

codspeed-hq bot commented Mar 28, 2025

CodSpeed Performance Report

Merging #9826 will not alter performance

Comparing fix-9780 (38e87aa) with main (b854e57)

🎉 Hooray! codspeed-node just leveled up to 4.0.1!

A heads-up, this is a breaking change and it might affect your current performance baseline a bit. But here's the exciting part - it's packed with new, cool features and promises improved result stability 🥳!
Curious about what's new? Visit our releases page to delve into all the awesome details about this new version.

Summary

✅ 11 untouched benchmarks

@fireairforce fireairforce changed the title fix: avoid import assert tranform to with fix: avoid import assert tranform to with for webpack test case Mar 30, 2025
@fireairforce fireairforce marked this pull request as ready for review March 30, 2025 03:22
@fireairforce fireairforce force-pushed the fix-9780 branch 3 times, most recently from c3773f7 to 12f0c1f Compare March 31, 2025 07:40
@fireairforce fireairforce changed the title fix: avoid import assert tranform to with for webpack test case feat: swc loader support emitAssertForImportAttributes config Mar 31, 2025
@github-actions github-actions bot added release: feature release: feature related release(mr only) and removed release: bug fix release: bug related release(mr only) labels Mar 31, 2025
@chenjiahan chenjiahan requested a review from GiveMe-A-Name April 1, 2025 06:55
GiveMe-A-Name
GiveMe-A-Name previously approved these changes Apr 17, 2025
Copy link
Member

@chenjiahan chenjiahan left a comment

Choose a reason for hiding this comment

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

You may need to update the schema too: #10055

chenjiahan
chenjiahan previously approved these changes Apr 17, 2025
Copy link
Member

@chenjiahan chenjiahan left a comment

Choose a reason for hiding this comment

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

Never mind, it has been included in the schema PR

@fireairforce fireairforce dismissed stale reviews from chenjiahan and GiveMe-A-Name via 972066a April 20, 2025 19:18
@fireairforce fireairforce force-pushed the fix-9780 branch 2 times, most recently from 972066a to cf381bf Compare April 20, 2025 19:19
@GiveMe-A-Name
Copy link
Member

CI failed

@fireairforce fireairforce enabled auto-merge (squash) April 21, 2025 05:37
@fireairforce fireairforce merged commit 971c977 into main Apr 21, 2025
27 checks passed
@fireairforce fireairforce deleted the fix-9780 branch April 21, 2025 05:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
release: feature release: feature related release(mr only)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Bug]: should not convert import assert to import with
3 participants