Adding Webpack in your WordPress plugin or theme might feel scary. I stepped out from my comfort zone while working on a new plugin. Since that plugin might be using React or Vue in a future version, I wanted to have Babel and similar there. In this tutorial, I will show you the steps I used to configure Webpack in WordPress for my first time. Since this is my first Webpack configuration, it may lack some of the useful plugins and scripts. If you think I should include something, you’re welcome to comment that at the end of this tutorial. Getting Started with Webpack To get started using Webpack, you must first install the pre-requisites. If you don’t have Node.js installed, go to the website and follow the install instructions. It will take you a few minutes of your time. That’s it! Now we can move on. Just check npm -v if you have that there. If not, you might want to restart your computer. But in general, you should only quite and re-open the terminal (command line). Since I have set this for my own plugin, I will talk about my plugin folder. For your own WordPress products, the only things that you will have to change is the path to your JavaScript or CSS (theme
Share This

We are using cookies on our website

Please confirm, if you accept our tracking cookies. You can also decline the tracking, so you can continue to visit our website without any data sent to third party services.