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

Add support for specifying external helpers to avoid patching SWC #1291

Open
xand3r40r93 opened this issue Feb 10, 2025 · 0 comments
Open

Add support for specifying external helpers to avoid patching SWC #1291

xand3r40r93 opened this issue Feb 10, 2025 · 0 comments

Comments

@xand3r40r93
Copy link

Currently, in order to enable externalHelpers for legacy decorators in SWC, users need to manually patch swc.transformFile. It would be helpful if tsup provided a way to specify this option without requiring modifications to SWC itself.

Example workaround:

const transformFile = swc.transformFile;
swc.transformFile = (filePath, options) => {
  if (options?.jsc?.transform?.legacyDecorator) options.jsc.externalHelpers = true;
  return transformFile.call(this, filePath, options);
};

Proposed solution:

Introduce an option in tsup to allow enabling externalHelpers when using decorators, eliminating the need for manual patches.

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

No branches or pull requests

1 participant