Search code examples
wordpresswebpackdeploymentbundle

How to deploy a WordPress Theme that is using webpack for bundling?


I used to developed WordPress themes in the early 2010's but I am now really out of fashion, especially with things like Webpack and npm.

I am following a tutorial and I have already finished my theme. Webpack bundles an assets folder with the production files. However, the src folder, package-lock.json and webpack.config.js are still in the root folder.

I know by common sense, but not pretty sure, that those files shouldn't be there since that's the reason of the bundling process. How do I distribute my template and further plugins or even React apps without sharing de src files and only the bundled and minified ones?


Solution

  • Here is the awesome tutorial for using Webpack and WordPress together.

    https://wptips.dev/webpack-in-wordpress/