Should we make @babel/runtime external when using rollup and babel to develop a react component lib?

Viewed 611

In the rollup-plugin-babel doc(https://github.com/rollup/plugins/tree/master/packages/babel), it says that we should set babelHelpers to runtime when building libraries with Rollup:

It has to be used in combination with @babel/plugin-transform-runtime and you should also specify @babel/runtime as dependency of your package.

That's ok and i understand it.

But i can't understand the following line:

Don't forget to tell Rollup to treat the helpers imported from within the @babel/runtime module as external dependencies when bundling for cjs & es formats

Why? As i know, the user of my lib should provide the @babel/runtime package if i make it external. But the user may not use it. It is NOT as common as react, etc.

0 Answers
Related