In late 2014, to split JavaScript files into maintainable modules, Browserify was introduced. Recently, WordPress is rapidly moving towards JavaScript.
A significant part of Gutenberg is composed of JavaScript. So, it is quite obvious to take a step towards the latest bundle manager available for JavaScript.
That’s why Adam Silverstein proposed to replace Browserify with Webpack four months ago.
While Browserify has served us well, Webpack is probably a better long-term choice for the project, especially with the introduction of a new JavaScript framework that may require a build.
โ Use Webpack instead of Browserify for build process
WordPress contributors made this decision four months ago. They even reached out to the contributors of Webpack for their review.
๐ After four months of hard work, the ticket finally made it to WordPress core on October 4th, 2017.
๐ย Kudos to the contributors who made it all possible.
๐คย What is a Bundle Manager?
To put in simple words, a bundle manager lets you use all of your project dependencies in the browser. It can also perform some other tasks like minifying, linting, testing, etc. Browserify and Webpack are the names of bundleย managers for JavaScript.
WordPress used to have Browserify to maintain its JS components. Webpack replaced it last week.
Here are some of the qualities of Webpack which made it a more natural choice.
โ๏ธ Pros of Using Webpack
- Webpack is easy to implement.
- Webpack does not require automation scripts like Gulp or Grunt.
- It has a single configuration file for the entire build process.
- Webpack provides automation tasks like minification out of the box.
- It also supports liveย reloading.
- And it does all of these tasks without requiring help from the outside scripts.
It is imminent that a JavaScript framework might land in WordPress core.ย So, Webpack looks like a smart choice to have around when that happens.
Do you think it was a smart decision? Let us know in the comments.
๐
SUBSCRIBE TO DEVELOPERS TAKEAWAY!
A Premium Development Newsletter by TheDevCouple! What is TheDevTakeaway?