This Content is from Stack Overflow. Question asked by Nathaniel Tucker
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.
This Question was asked in StackOverflow by Nathaniel Tucker and Answered by Bruno Peres It is licensed under the terms of CC BY-SA 2.5. - CC BY-SA 3.0. - CC BY-SA 4.0.