html-render-webpack-plugin
Version:
webpack plugin for rendering static HTML in a multi-config webpack build
35 lines (32 loc) • 755 B
JavaScript
const path = require("path");
const srcPath = path.resolve(__dirname, "./src");
const paths = {
renderEntry: path.resolve(srcPath, "render.js"),
clientEntry: path.resolve(srcPath, "client.js"),
};
module.exports = (plugin) => [
{
name: "client",
target: "web",
mode: "production",
entry: paths.clientEntry,
output: {
filename: "client-[name]-[contenthash].js",
},
plugins: [plugin],
},
{
dependencies: ["client"],
name: "render",
target: "node",
mode: "production",
entry: paths.renderEntry,
output: {
libraryExport: "default",
library: "static",
libraryTarget: "umd2",
filename: "render-[name]-[contenthash].js",
},
plugins: [plugin.render()],
},
];