preset-env only includes global altering polyfills core-js, which is not great as a library author.
https://github.com/zloirock/core-js#babelruntime talks about a babel transform for imports but none of them work on Object.hasOwn().
preset-env only includes global altering polyfills core-js, which is not great as a library author.
https://github.com/zloirock/core-js#babelruntime talks about a babel transform for imports but none of them work on Object.hasOwn().
You can transform any code into another code using babel, that is exactly the role of babel transformations. Seems that there is one plugin available (disclaimer: I've never used it) but you can how the function would look like after the babel transformation, or you could also write your own babel-plugin for it.
You could also ship a polyfill together with your library, or require it as a dependency of your library.