rollup / rollup-plugin-babel

This package has moved and is now available at @rollup/plugin-babel / https://github.com/rollup/plugins/tree/master/packages/babel

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Some symbols are removed from the bundle, but polyfill imports are left for them

slavafomin opened this issue · comments

Hello!

Thank you for this great plugin!

But, could you please share your thoughts on the following issue?

Consider a case, where there is a symbol in the source code, which triggers addition of the polyfill import by preset-env, like import 'core-js/modules/es.promise'. However, this symbol is not used and not exported by the library, therefore Rollup removes it from the final bundle. And right now we have a situation where the symbol itself is removed, but the polyfill for it is left in the header of the bundle.

Do you think if something could be done about it?

Thanks!


We are using the following configuration now:

babelPlugin(<BabelConfig | BabelPluginConfig> {
  extensions: ['.js', '.jsx', '.ts', '.tsx'],
  root: projectPath,
  babelrc: false,
  runtimeHelpers: true,
  presets: [
    [babelPresetEnv, {
      useBuiltIns: 'usage',
      corejs: 3,
    }],
  ],
  plugins: [
    [babelPluginTransformRuntime, {
      helpers: true,
      regenerator: false,
      corejs: false,
    }],
  ],
  exclude: [
    '**/node_modules/**',
  ],
})

And we have the rollup-plugin-typescript2 before that.

I'm not sure if I understand the issue correctly. Could you set up a repro case for this?

As we’ve not received a repro case I’m going to close this. If you manage to create one please ping me and I will reopen this.