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

Enhanced - remove import require statements for swc interop #1474

Conversation

RussellCanfield
Copy link
Collaborator

@ScriptedAlchemy - it turns out the import require syntax can be worked around if we use the swc interop helper:

https://swc.rs/docs/configuration/modules#nointerop

We can technically just remove noInterop from .swcrc and it'll work but I made them explicit for now. You can see the difference in the compiled code where they wrap require statements in their wrapper. But this removes the need to import = require().

Tested with start:node and start:next

@RussellCanfield RussellCanfield changed the base branch from main to node-sync-bytedance September 30, 2023 19:22
Copy link
Member

@ScriptedAlchemy ScriptedAlchemy left a comment

Choose a reason for hiding this comment

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

You're a godsend

@RussellCanfield RussellCanfield changed the title Rcanfield node sync bytedance import require Enhanced - remove import require statements for swc interop Sep 30, 2023
@RussellCanfield
Copy link
Collaborator Author

You're a godsend

Merge?

@ScriptedAlchemy ScriptedAlchemy merged commit 37458b7 into node-sync-bytedance Oct 2, 2023
4 checks passed
@ScriptedAlchemy ScriptedAlchemy deleted the rcanfield-node-sync-bytedance-ImportRequire branch October 2, 2023 22:23
@github-actions
Copy link
Contributor

🎉 This PR is included in version 8.1.0-canary.1 🎉

The release is available on:

Your semantic-release bot 📦🚀

Copy link
Contributor

github-actions bot commented Nov 6, 2023

🎉 This PR is included in version 2.1.0-canary.1 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants