1
0
mirror of https://github.com/lensapp/lens.git synced 2025-05-20 05:10:56 +00:00

fix config import error, allow to run separated webpack's renderer configs for both apps

This commit is contained in:
Roman 2020-06-18 14:53:23 +03:00
parent 58c814d7eb
commit 1169b862b3
6 changed files with 19 additions and 20 deletions

View File

@ -1,14 +1,8 @@
{ {
"presets": [ "presets": [
[ ["@babel/preset-env", {
"@babel/preset-env", "modules": "commonjs"
{ }],
"modules": "commonjs",
"targets": {
"esmodules": false
}
}
],
"@babel/preset-react", "@babel/preset-react",
"@lingui/babel-preset-react" "@lingui/babel-preset-react"
], ],
@ -18,7 +12,6 @@
[ [
"@babel/plugin-transform-runtime", "@babel/plugin-transform-runtime",
{ {
"absoluteRuntime": false,
"regenerator": true, "regenerator": true,
"useESModules": true "useESModules": true
} }

View File

@ -5,13 +5,15 @@
"version": "3.5.0-beta.1", "version": "3.5.0-beta.1",
"main": "dist/main.js", "main": "dist/main.js",
"scripts": { "scripts": {
"dev": "concurrently yarn:dev:*", "dev": "concurrently 'yarn dev:main' 'yarn dev:renderer'",
"dev-run": "electron --inspect .", "dev-run": "electron --inspect .",
"dev:main": "DEBUG=true webpack --watch --progress --config webpack.main.ts", "dev:main": "DEBUG=true yarn compile:main --watch $@",
"dev:renderer": "DEBUG=true webpack --watch --progress --config webpack.renderer.ts", "dev:renderer": "DEBUG=true yarn compile:renderer --watch $@",
"compile": "NODE_ENV=production concurrently 'yarn download-bins' 'yarn i18n:compile' && concurrently yarn:compile:*", "dev:react": "yarn dev:renderer --config-name react",
"compile:main": "NODE_ENV=production webpack --progress --config webpack.main.ts $@", "dev:vue": "yarn dev:renderer --config-name vue",
"compile:renderer": "NODE_ENV=production webpack --progress --config webpack.renderer.ts $@", "compile": "yarn download-bins && concurrently 'yarn i18n:compile' 'yarn compile:main -p' 'yarn compile:renderer -p'",
"compile:main": "webpack --progress --config webpack.main.ts $@",
"compile:renderer": "webpack --progress --config webpack.renderer.ts $@",
"compile:dll": "webpack --config webpack.dll.ts $@", "compile:dll": "webpack --config webpack.dll.ts $@",
"build:linux": "yarn compile && electron-builder --linux --dir -c.productName=LensDev", "build:linux": "yarn compile && electron-builder --linux --dir -c.productName=LensDev",
"build:mac": "yarn compile && electron-builder --mac --dir -c.productName=LensDev", "build:mac": "yarn compile && electron-builder --mac --dir -c.productName=LensDev",

View File

@ -7,7 +7,6 @@ import { readFileSync, watch } from "fs"
import { PromiseIpc } from "electron-promise-ipc" import { PromiseIpc } from "electron-promise-ipc"
import { findMainWebContents } from "./webcontents" import { findMainWebContents } from "./webcontents"
import * as url from "url" import * as url from "url"
import { apiPrefix } from "../common/vars";
export class KubeAuthProxy { export class KubeAuthProxy {
public lastError: string public lastError: string

View File

@ -155,6 +155,7 @@ export default function initMenu(opts: MenuOptions, promiseIpc: any) {
...(isDevelopment ? [ ...(isDevelopment ? [
{ role: 'toggleDevTools' } as MenuItemConstructorOptions, { role: 'toggleDevTools' } as MenuItemConstructorOptions,
{ {
accelerator: "CmdOrCtrl+Shift+I",
label: 'Open Dashboard Devtools', label: 'Open Dashboard Devtools',
click() { click() {
webContents.getFocusedWebContents().openDevTools() webContents.getFocusedWebContents().openDevTools()

View File

@ -1,7 +1,8 @@
import { observable, when } from "mobx";
import type { IConfigRoutePayload } from "../main/routes/config"; import type { IConfigRoutePayload } from "../main/routes/config";
import { observable, when } from "mobx";
import { autobind, interval } from "./utils"; import { autobind, interval } from "./utils";
import { configApi } from "./api/endpoints"; import { configApi } from "./api/endpoints/config.api";
@autobind() @autobind()
export class ConfigStore { export class ConfigStore {

View File

@ -15,8 +15,9 @@ export default [
export function webpackConfigReact(): webpack.Configuration { export function webpackConfigReact(): webpack.Configuration {
return { return {
context: __dirname, context: __dirname,
name: "react",
target: "web", target: "web",
devtool: isProduction ? "source-map" : "cheap-eval-source-map", devtool: "source-map", // todo: optimize in dev-mode with webpack.SourceMapDevToolPlugin
mode: isProduction ? "production" : "development", mode: isProduction ? "production" : "development",
cache: isDevelopment, cache: isDevelopment,
entry: { entry: {
@ -66,6 +67,7 @@ export function webpackConfigReact(): webpack.Configuration {
// https://lingui.js.org/guides/typescript.html // https://lingui.js.org/guides/typescript.html
jsx: "preserve", jsx: "preserve",
target: "es2016", target: "es2016",
module: "esnext",
}, },
} }
} }
@ -138,6 +140,7 @@ export function webpackConfigReact(): webpack.Configuration {
export function webpackConfigVue(): webpack.Configuration { export function webpackConfigVue(): webpack.Configuration {
const config = webpackConfigReact(); const config = webpackConfigReact();
config.name = "vue"
config.target = "electron-renderer"; config.target = "electron-renderer";
config.resolve.extensions.push(".vue"); config.resolve.extensions.push(".vue");