Fix base.output (see #1911) (#1943)
authorDaniele Basso <d.bass05@proton.me>
Fri, 14 Jul 2023 20:52:05 +0000 (20:52 +0000)
committerGitHub <noreply@github.com>
Fri, 14 Jul 2023 20:52:05 +0000 (16:52 -0400)
webpack.config.js

index 267a14451912fe4699a93df47dab4946fb17b1ca..b12af48334aa7647f79a101451e23af391861e9a 100644 (file)
@@ -3,7 +3,6 @@ const { resolve } = require("path");
 const MiniCssExtractPlugin = require("mini-css-extract-plugin");
 const nodeExternals = require("webpack-node-externals");
 const CopyPlugin = require("copy-webpack-plugin");
-const RunNodeWebpackPlugin = require("run-node-webpack-plugin");
 const { ServiceWorkerPlugin } = require("service-worker-webpack");
 
 const banner = `
@@ -18,8 +17,6 @@ module.exports = (env, argv) => {
 
   const base = {
     output: {
-      filename: "js/server.js",
-      publicPath: "/",
       hashFunction: "xxhash64",
     },
     resolve: {
@@ -73,7 +70,9 @@ module.exports = (env, argv) => {
     ...base,
     entry: "./src/server/index.tsx",
     output: {
+      ...base.output,
       filename: "js/server.js",
+      publicPath: "/",
     },
     target: "node",
     externals: [nodeExternals(), "inferno-helmet"],
@@ -83,6 +82,7 @@ module.exports = (env, argv) => {
     ...base,
     entry: "./src/client/index.tsx",
     output: {
+      ...base.output,
       filename: "js/client.js",
       publicPath: `/static/${env.COMMIT_HASH}/`,
     },
@@ -146,6 +146,7 @@ module.exports = (env, argv) => {
     //   name: "server",
     // };
 
+    const RunNodeWebpackPlugin = require("run-node-webpack-plugin");
     serverConfig.plugins.push(
       new RunNodeWebpackPlugin({ runOnlyInWatchMode: true })
     );