Open Mrtenz opened 4 months ago
To be clear, @Mrtenz and I are willing to submit a PR for this feature. But we would need some guidance on how best to implement it. E.g. should we simply add a configuration option for this or automatically determine the value of disableESTransforms
by looking at the target
?
tsup
usessucrase
to transpile ESM to CJS when code splitting is enabled:https://github.com/egoist/tsup/blob/83c7c7f3131ca6d46aaad4de3111c2fd5e5b5c21/src/plugins/cjs-splitting.ts#L21-L31
Unfortunately there is no way right now to specify the settings for
sucrase
. In our case, we wanted to disable the optional chaining polyfill thatsucrase
adds, since it's problematic for static analysis. The only way to do so seems to be by settingdisableESTransforms: true
in the options. It would be great iftsup
had an option to set this.Upvote & Fund