mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
Fix node-fetch load on renderer (#3836)
* fix node-fetch load on renderer Signed-off-by: Jari Kolehmainen <jari.kolehmainen@gmail.com> * cleanup Signed-off-by: Jari Kolehmainen <jari.kolehmainen@gmail.com> * cleanup Signed-off-by: Jari Kolehmainen <jari.kolehmainen@gmail.com>
This commit is contained in:
parent
249abfad67
commit
ae726f936e
@ -31,7 +31,6 @@ import { IpcRendererNavigationEvents } from "../renderer/navigation/events";
|
|||||||
import logger from "./logger";
|
import logger from "./logger";
|
||||||
import { productName } from "../common/vars";
|
import { productName } from "../common/vars";
|
||||||
import { LensProxy } from "./lens-proxy";
|
import { LensProxy } from "./lens-proxy";
|
||||||
import * as path from "path";
|
|
||||||
|
|
||||||
function isHideable(window: BrowserWindow | null): boolean {
|
function isHideable(window: BrowserWindow | null): boolean {
|
||||||
return Boolean(window && !window.isDestroyed());
|
return Boolean(window && !window.isDestroyed());
|
||||||
@ -85,7 +84,6 @@ export class WindowManager extends Singleton {
|
|||||||
titleBarStyle: "hiddenInset",
|
titleBarStyle: "hiddenInset",
|
||||||
backgroundColor: "#1e2124",
|
backgroundColor: "#1e2124",
|
||||||
webPreferences: {
|
webPreferences: {
|
||||||
preload: path.join(__static, "build", "preload.js"),
|
|
||||||
nodeIntegration: true,
|
nodeIntegration: true,
|
||||||
nodeIntegrationInSubFrames: true,
|
nodeIntegrationInSubFrames: true,
|
||||||
enableRemoteModule: true,
|
enableRemoteModule: true,
|
||||||
|
|||||||
@ -22,7 +22,7 @@
|
|||||||
import path from "path";
|
import path from "path";
|
||||||
import type webpack from "webpack";
|
import type webpack from "webpack";
|
||||||
import ForkTsCheckerPlugin from "fork-ts-checker-webpack-plugin";
|
import ForkTsCheckerPlugin from "fork-ts-checker-webpack-plugin";
|
||||||
import { isProduction, mainDir, buildDir, isDevelopment, preloadEntrypoint } from "./src/common/vars";
|
import { isProduction, mainDir, buildDir, isDevelopment } from "./src/common/vars";
|
||||||
import nodeExternals from "webpack-node-externals";
|
import nodeExternals from "webpack-node-externals";
|
||||||
import ProgressBarPlugin from "progress-bar-webpack-plugin";
|
import ProgressBarPlugin from "progress-bar-webpack-plugin";
|
||||||
import * as vars from "./src/common/vars";
|
import * as vars from "./src/common/vars";
|
||||||
@ -68,41 +68,4 @@ configs.push((): webpack.Configuration => {
|
|||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|
||||||
configs.push((): webpack.Configuration => {
|
|
||||||
console.info("WEBPACK:preload", vars);
|
|
||||||
|
|
||||||
return {
|
|
||||||
context: __dirname,
|
|
||||||
target: "electron-main",
|
|
||||||
mode: isProduction ? "production" : "development",
|
|
||||||
devtool: isProduction ? "source-map" : "cheap-eval-source-map",
|
|
||||||
cache: isDevelopment,
|
|
||||||
entry: {
|
|
||||||
main: path.resolve(preloadEntrypoint),
|
|
||||||
},
|
|
||||||
output: {
|
|
||||||
libraryTarget: "global",
|
|
||||||
path: buildDir,
|
|
||||||
filename: "preload.js"
|
|
||||||
},
|
|
||||||
resolve: {
|
|
||||||
extensions: [".json", ".js", ".ts"],
|
|
||||||
mainFields: ["main"]
|
|
||||||
},
|
|
||||||
module: {
|
|
||||||
rules: [
|
|
||||||
{
|
|
||||||
test: /\.node$/,
|
|
||||||
use: "node-loader"
|
|
||||||
},
|
|
||||||
getTSLoader(/\.ts$/)
|
|
||||||
]
|
|
||||||
},
|
|
||||||
plugins: [
|
|
||||||
new ProgressBarPlugin(),
|
|
||||||
new ForkTsCheckerPlugin(),
|
|
||||||
].filter(Boolean)
|
|
||||||
};
|
|
||||||
});
|
|
||||||
|
|
||||||
export default configs;
|
export default configs;
|
||||||
|
|||||||
@ -79,6 +79,9 @@ export function webpackLensRenderer({ showVars = true } = {}): webpack.Configura
|
|||||||
".ts", ".tsx",
|
".ts", ".tsx",
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
externals: {
|
||||||
|
"node-fetch": "commonjs node-fetch"
|
||||||
|
},
|
||||||
optimization: {
|
optimization: {
|
||||||
minimize: false
|
minimize: false
|
||||||
},
|
},
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user