Browse Source

Video 1.3: environments and composition.

Frederic G. MARAND 4 years ago
parent
commit
dc2920d3c3
2 changed files with 13 additions and 9 deletions
  1. 11 0
      build-utils/webpack.common.js
  2. 2 9
      webpack.config.js

+ 11 - 0
build-utils/webpack.common.js

@@ -0,0 +1,11 @@
+const path = require("path"); // NodeJS builtin.
+
+const config = {
+  entry: "./src/",
+  output: {
+    filename: "bundle.js",
+    path: path.join(__dirname, "../dist") // path must be absolute.
+  }
+};
+
+module.exports = config;

+ 2 - 9
webpack.config.js

@@ -1,14 +1,7 @@
-const path = require("path"); // NodeJS builtin.
+const commonConfig = require("./build-utils/webpack.common");
 
 // Export a function returning config instead of a static config.
 // The purpose is to allow use of the environment.
 module.exports = env => {
-  console.log(env);
-  return {
-    entry: "./src/",
-    output: {
-      filename: "bundle.js",
-      path: path.join(__dirname, "dist") // path must be absolute.
-    }
-  };
+  return { ...commonConfig };
 };