mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
attempt to use webpack-dev-server via node-api -- part 1
Signed-off-by: Roman <ixrock@gmail.com>
This commit is contained in:
1 parent
98b516f290
commit
92a5c785a3
6 files changed
+871
-31
No files matched your search
+6
-1
@@ -10,7 +10,7 @@ import * as Mobx from "mobx";
|
||||
import * as LensExtensionsCommonApi from "../extensions/common-api";
|
||||
import * as LensExtensionsMainApi from "../extensions/main-api";
|
||||
import { app, autoUpdater, dialog, powerMonitor } from "electron";
|
||||
import { appName, isIntegrationTesting, isMac, isWindows, productName } from "../common/vars";
|
||||
import { appName, isIntegrationTesting, isMac, isWindows, productName, isDevelopment } from "../common/vars";
|
||||
import { LensProxy } from "./lens-proxy";
|
||||
import { WindowManager } from "./window-manager";
|
||||
import { ClusterManager } from "./cluster-manager";
|
||||
@@ -55,6 +55,7 @@ import routerInjectable from "./router/router.injectable";
|
||||
import shellApiRequestInjectable from "./proxy-functions/shell-api-request/shell-api-request.injectable";
|
||||
import userStoreInjectable from "../common/user-store/user-store.injectable";
|
||||
import trayMenuItemsInjectable from "./tray/tray-menu-items.injectable";
|
||||
import { createDevServer } from "../../webpack.dev-server";
|
||||
|
||||
const di = getDi();
|
||||
|
||||
@@ -177,6 +178,10 @@ di.runSetups().then(() => {
|
||||
try {
|
||||
logger.info("🔌 Starting LensProxy");
|
||||
await lensProxy.listen();
|
||||
|
||||
if (isDevelopment) {
|
||||
await createDevServer(lensProxy.port).start();
|
||||
}
|
||||
} catch (error) {
|
||||
dialog.showErrorBox("Lens Error", `Could not start proxy: ${error?.message || "unknown error"}`);
|
||||
|
||||
|
||||
@@ -124,6 +124,21 @@ export class Router {
|
||||
}
|
||||
|
||||
try {
|
||||
// const filename = path.basename(req.url);
|
||||
// redirect requests to [appName].js, [appName].html /sockjs-node/ to webpack-dev-server (for hot-reload support)
|
||||
// const toWebpackDevServer = filename.includes(appName) || filename.includes("hot-update") || req.url.includes("sockjs-node");
|
||||
//
|
||||
// if (isDevelopment /*&& toWebpackDevServer*/) {
|
||||
// const redirectLocation = `http://localhost:${webpackDevServerPort}${req.url}`;
|
||||
//
|
||||
// logger.info(`[ROUTER]: redirecting to dev-server url: ${redirectLocation}`);
|
||||
//
|
||||
// response.statusCode = 307;
|
||||
// response.setHeader("Location", redirectLocation);
|
||||
//
|
||||
// return response.end();
|
||||
// }
|
||||
|
||||
const data = await readFile(asset);
|
||||
|
||||
response.setHeader("Content-Type", getMimeType(asset));
|
||||
|
||||
Reference in new issue
Block a user