I'm working on a WordPress plugin and have a file structure like this:
/public/
/js/
/modules/
/public.bundled.js // how to output public here?
/admin/
/js/
/modules/
/admin.bundled.js //how to output admin here?
I'm incorporating webpack into the development process and want to output the bundled files into their respective directories, but am new to Webpack and not sure how to achieve this. Here's my config:
const path = require("path");
module.exports = {
entry: {
public: __dirname + "/public/js/modules/public.js",
admin: __dirname + "/admin/js/modules/admin.js",
},
output: {
filename: "[name].bundled.js",
path: // Not sure how to achieve this. Any ideas?
},
mode: "development",
watch: true,
};
Any ideas how to achieve what I'm looking for? Thank you in advance.