这是indexloc提供的服务,不要输入任何密码
Skip to content

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

@xand3r40r93

Description

@xand3r40r93

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions