Which Babel Settings Are Suitable For Exporting A Library?
I am new to Babel+Webpack and have some confusion regarding .babelrc configuration. FIRST CONFIGURATION { 'presets': [ [ '@babel/env', {
Solution 1:
For libraries Rollup is a much better option than WebPack.
This a good starting point.
https://github.com/rollup/rollup-starter-lib
If you must use webpack, avoid using regenerater, as it adds a lot of bloat to the output of Babel, if you code needs it, then the consuming app should include it, so you don’t end up having it twice in the end app
Solution 2:
Ran into this myself, in the past. Honestly, Webpack is terrible with anything that exports more than a single default, which is why you see most libraries use Rollup or Parcel for bundling.
Post a Comment for "Which Babel Settings Are Suitable For Exporting A Library?"