chrisprice/grunt-rollup

Plugins leak state between bundles

fatfisz opened this issue · 0 comments

Continuing from: rollup/rollup#589.

grunt-rollup supports multiple bundles, but the way the plugins are currently handled causes leaks.

For example, the rollup-plugin-babel plugin collects helpers used in a bundle. So when there are two bundles: A and B, B will receive helpers used in A even if B doesn't use them.

I suggest one of these solutions:

  • allow a function as the "plugins" property value:
plugins() {
  return [
    rollupPluginBabel(),
  ];
}
  • allow functions as elements of the "plugins" property value:
plugins: [
  () => rollupPluginBabel(),
];