@bonsae/nrg 0.5.1 → 0.5.2
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
CHANGED
package/src/core/server/index.ts
CHANGED
|
@@ -32,9 +32,19 @@ function serveNrgResources(RED: RED): void {
|
|
|
32
32
|
httpAdmin.use(function (req: any, res: any, next: any) {
|
|
33
33
|
const prefix = "/nrg/assets/";
|
|
34
34
|
if (!(req.path as string).startsWith(prefix)) return next();
|
|
35
|
-
|
|
35
|
+
let reqPath = (req.path as string)
|
|
36
36
|
.slice(prefix.length)
|
|
37
37
|
.replace(/\.\./g, "");
|
|
38
|
+
// Serve the Vue dev build in development for devtools support
|
|
39
|
+
if (
|
|
40
|
+
reqPath === "vue.esm-browser.prod.js" &&
|
|
41
|
+
process.env.NODE_ENV !== "production"
|
|
42
|
+
) {
|
|
43
|
+
const devPath = path.resolve(clientDir, "vue.esm-browser.js");
|
|
44
|
+
if (fs.existsSync(devPath)) {
|
|
45
|
+
reqPath = "vue.esm-browser.js";
|
|
46
|
+
}
|
|
47
|
+
}
|
|
38
48
|
const filePath = path.resolve(clientDir, reqPath);
|
|
39
49
|
if (!filePath.startsWith(clientDir)) return next();
|
|
40
50
|
if (!fs.existsSync(filePath) || !fs.statSync(filePath).isFile())
|