Lessons Learned From a Year of Fighting With Webpack and Babel

Meaning that we should at least get a warning if we specify that we target browsers in our package.json and we import a package that doesn’t have the browser field in its package.json.The engines field, This is usually used to specify the node versions your package targets, but I honestly think it should also be used to specify ES versions, since a lot of NPM’s usage is targeting browsers nowadays.If a package doesn’t have any of these fields and we specified that we target browsers and ES5 then we should:Get a warning when we import it.Have Webpack plugins that detect these packages and un-exclude them so they get transpiled automatically.Closing NotesWebpack and Babel are awesome, this article isn’t trying to say otherwise..We wouldn’t be able to use a lot of things if it weren’t for them, but the experience of using them together needs to get better..I faced many of these issues over the course of many months and understanding them/finding solutions was incredibly difficult (error messages don’t exactly tell you what went wrong and searching for them doesn’t always give relevant results), and I hope this article can act as the guide I had hoped to find back then.. More details

Leave a Reply