@stanlemon/webdev 0.1.6 → 0.1.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/webpack.config.js +14 -0
package/package.json
CHANGED
package/webpack.config.js
CHANGED
|
@@ -19,8 +19,21 @@ const WEBDEV_ENTRY = process.env.WEBDEV_ENTRY ?? "./src/index.tsx";
|
|
|
19
19
|
// If you prefix a page with a ! it will disable script injection
|
|
20
20
|
// The filename from the supplied path is used as the filename of the resulting file
|
|
21
21
|
const WEBDEV_HTML = process.env.WEBDEV_HTML ?? "./index.html";
|
|
22
|
+
// Proxy path's can be designated as path@host, separated by semi-colons
|
|
23
|
+
// For example /api@http://localhost:3000;/auth@http://localhost:4000
|
|
24
|
+
const WEBDEV_PROXY = process.env.WEBDEV_HTML ?? "";
|
|
22
25
|
const NODE_ENV = process.env.NODE_ENV ?? "development";
|
|
23
26
|
|
|
27
|
+
const proxy = {};
|
|
28
|
+
WEBDEV_PROXY.split(";").forEach((entry) => {
|
|
29
|
+
if (entry.indexOf("@") === -1) {
|
|
30
|
+
return;
|
|
31
|
+
}
|
|
32
|
+
const path = entry.substring(0, entry.indexOf("@"));
|
|
33
|
+
const host = entry.substring(entry.indexOf("@") + 1);
|
|
34
|
+
proxy[path] = host;
|
|
35
|
+
});
|
|
36
|
+
|
|
24
37
|
const isDevelopment = NODE_ENV !== "production";
|
|
25
38
|
|
|
26
39
|
export default {
|
|
@@ -34,6 +47,7 @@ export default {
|
|
|
34
47
|
devServer: {
|
|
35
48
|
hot: true,
|
|
36
49
|
historyApiFallback: true,
|
|
50
|
+
proxy,
|
|
37
51
|
},
|
|
38
52
|
optimization: {
|
|
39
53
|
moduleIds: "deterministic",
|