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

Implicitly added babel plugins #189

Closed
simonihmig opened this issue Jul 22, 2022 · 3 comments · Fixed by #205
Closed

Implicitly added babel plugins #189

simonihmig opened this issue Jul 22, 2022 · 3 comments · Fixed by #205

Comments

@simonihmig
Copy link

  • Version: 3.0.2
  • Rollup Version: 2.77.0
  • Operating System and version (if applicable): OSX
  • Node Version (if applicable): 16
  • Does it work with tsc (if applicable): n/a

Reproduction

  • add the plugin with a config like this:
typescript({
  transpiler: 'babel',
  browserslist: false,
  transpileOnly: false,
})
  • let it compile code that includes for example object spread syntax

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
Copy link
Author

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

@bartocc
Copy link

bartocc commented May 26, 2023

Hi all 👋

PR #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
Copy link
Owner

wessberg commented Aug 3, 2023

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.

@wessberg wessberg closed this as completed Aug 3, 2023
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

Successfully merging a pull request may close this issue.

3 participants