rollup-plugin-auto-external icon indicating copy to clipboard operation
rollup-plugin-auto-external copied to clipboard

@babel/polyfill support

Open jeremy-ww opened this issue 5 years ago • 1 comments

Hi, seem like rollup-plugin-auto-external doesn't support dependencies' dependencies. When I include @babel/polyfill in dependencies, It also require('core-js') in final bundle.

"dependencies": {
  "@babel/polyfill": "^7.0.0", // it will require `core-js`
  "@babel/runtime": "^7.1.5"
}

Then I get a warning here:

'core-js/modules/es6.array.iterator' is imported by xxx.ts, but could not be resolved – treating it as an external dependency

That's what I did temporarily.

external: id => {
  try {
    require(id) // Exited in node_modules
    return true
  } catch (e) {}
}

jeremy-ww avatar Mar 14 '19 03:03 jeremy-ww

rollup-plugin-babel-runtime-external should do the trick for you. Care to give it a go and tell me how it went?

stevenbenisek avatar Mar 16 '19 09:03 stevenbenisek