babel-runtime dependency
asapach opened this issue · comments
babel-runtime
is listed as dependency
in package.json
rather than devDependency
- is that intended? How is it required to use this lib? There's no dependency on React, but why is there a dependency on Babel?
The babel-runtime
dependency goes along with the babel-plugin-transform-runtime
transform:
https://babeljs.io/docs/plugins/transform-runtime/
react-highlight-words
declares react
as a peer dependency because that enables application authors to choose which version of React they want to use and avoids potential conflicts, like facebook/react/issues/8026.
Yes, but babel-plugin-transform-runtime
is a devDependency
and devDependencies don't get installed when your consumers do npm install highlight-words-core
.
You only need to worry about devDependencies
directly if you're building this library.
The reason babel-runtime
is specified as a dependency is because the babel-plugin-transform-runtime
transform inserts code that expects it. This is explained on the Babel page I linked to above. 😄
OK, I've read through https://babeljs.io/docs/plugins/transform-runtime/ and understand where I was confused before. The thing is that your code is not using classes or generators or any other ES6 features that would require the runtime, so it's not actually being used: https://unpkg.com/highlight-words-core@1.1.0/dist/index.js. I would suggest removing the plugin and getting rid of the dependency.
I'd be happy with removing the runtime dependency if it's not being used, if you want to build this project and do some testing locally. It's not a super high priority for me TBH. 😄
OK, I'll send a new PR tomorrow after I've done some testing.