wessberg / rollup-plugin-ts

A TypeScript Rollup plugin that bundles declarations, respects Browserslists, and enables seamless integration with transpilers such as babel and swc
MIT License
496 stars 33 forks source link

Implicitly added babel plugins #189

Closed simonihmig closed 1 year ago

simonihmig commented 2 years ago

Reproduction

typescript({
  transpiler: 'babel',
  browserslist: false,
  transpileOnly: false,
})

Expected Behavior

I am trying to apply only the explicitly configured babel plugins, and otherwise let the code be "ESLatest".

The docs say:

If you don't want this behavior, simply pass the browserslist: false option to the plugin. Doing so will never apply @babel/preset-env and not apply any additional syntax transformations

According to this, I am expecting only the explicitly configured babel plugins to be used. Which means the object spread is not transpiled away.

Actual Behavior

My use of object spread syntax is unnecessarily transpiled away, and this babel helper function is included as a polyfill into the bundle.

Comment

Amongst others, @babel/plugin-proposal-object-rest-spread is added implicitly here. I do not understand the rationale behind this logic. Why are these plugins implicitly added? And why specifically these five? Object spread is AFAIK an approved ES2018 feature, supported in all modern browsers and node. So no need for transpilation by default, and without a way to disable this behavior.

simonihmig commented 1 year ago

Hey @wessberg, any chance you could have a look at this?

bartocc commented 1 year ago

Hi all 👋

PR https://github.com/wessberg/rollup-plugin-ts/pull/205 has been created 3 month ago to fix this, but no activity on this ticket or the PR since…

Is there a chance this could get a review?

wessberg commented 1 year ago

Hi there,

As rollup-plugin-ts is no longer implicitly adding any syntax-/proposal babel plugins such as object-rest-spread since v3.3.0, I'm closing this issue. Thanks.