mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
fixing circular dependencies, part 1
This commit is contained in:
1 parent
5d6826771a
commit
29197dcfb9
11 files changed
+37
-19
No files matched your search
+3
-3
@@ -9,7 +9,7 @@ import { kubeconfigRoute } from "./routes/kubeconfig"
|
||||
import { metricsRoute } from "./routes/metrics"
|
||||
import { watchRoute } from "./routes/watch"
|
||||
import { portForwardRoute } from "./routes/port-forward"
|
||||
import { getOutPath } from "../common/register-static";
|
||||
import { outDir, reactAppName } from "../common/vars";
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-var-requires
|
||||
const Call = require('@hapi/call');
|
||||
@@ -86,11 +86,11 @@ export class Router {
|
||||
}
|
||||
|
||||
protected handleStaticFile(filePath: string, response: http.ServerResponse) {
|
||||
const asset = getOutPath(filePath);
|
||||
const asset = path.resolve(outDir, filePath);
|
||||
readFile(asset, (err, data) => {
|
||||
if (err) {
|
||||
// default to index.html so that react routes work when page is refreshed
|
||||
this.handleStaticFile("app_react.html", response)
|
||||
this.handleStaticFile(`${reactAppName}.html`, response)
|
||||
} else {
|
||||
const type = mimeTypes[path.extname(asset).slice(1)] || "text/plain";
|
||||
response.setHeader("Content-Type", type);
|
||||
|
||||
Reference in new issue
Block a user