mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
Upgrade to webpack@5 (#4725)
* attempt to upgrade webpack@5 and all relevant packages to latest version -- part 1 Signed-off-by: Roman <ixrock@gmail.com> * debugging webpack@5 usage -- part 1 Signed-off-by: Roman <ixrock@gmail.com> * - attempt to use "react-refresh-typescript" with webpack@5 thingy - extending getTSLoader() to accept more options from ts-loader Signed-off-by: Roman <ixrock@gmail.com> * more fixes, updating webpack loaders Signed-off-by: Roman <ixrock@gmail.com> * merge-fixes, using internal webpack@5 asset handlers (type: "asset/*") Signed-off-by: Roman <ixrock@gmail.com> * fix: raw-loader / <Icon svg="./*">, updated mocked types for importing resources via webpack Signed-off-by: Roman <ixrock@gmail.com> * removing webpack-dev-server, clean up Signed-off-by: Roman <ixrock@gmail.com> * fix master-merge conflict Signed-off-by: Roman <ixrock@gmail.com> * fix/reverted: use sourceMap for styles Signed-off-by: Roman <ixrock@gmail.com> * fix lint Signed-off-by: Roman <ixrock@gmail.com> * fix: loading svg icons inline as data-url (workaround for "?raw" as it fails in tests and "!!raw-loader!" seems doesn't work at all in webpack@5) Signed-off-by: Roman <ixrock@gmail.com> * attempt to use webpack-dev-server via node-api -- part 1 Signed-off-by: Roman <ixrock@gmail.com> * attempt to use webpack-dev-server via node-api -- part 2 Signed-off-by: Roman <ixrock@gmail.com> * fix: incorrect parsing svg-icon xml-content by <HotbarEntityIcon/> Signed-off-by: Roman <ixrock@gmail.com> * fix: more random fixes related to incorrect parsing svg-icon content, added static Icon.isSvg(content: string) Signed-off-by: Roman <ixrock@gmail.com> * attempt to fix: "Uncaught (in promise) DOMException: A network error occurred." when loading cluster frame -- part 1 Signed-off-by: Roman <ixrock@gmail.com> * fix: loading cluster frame + error in loading terminal default font (which was causing network exception error and hidden cluster-view) fix: proxying websockets (e.g. terminal) Signed-off-by: Roman <ixrock@gmail.com> * fix: wait lensProxy.listen() to obtain lensProxy.port for webpack-dev-server Signed-off-by: Roman <ixrock@gmail.com> * fix lint Signed-off-by: Roman <ixrock@gmail.com> * fix unit tests Signed-off-by: Roman <ixrock@gmail.com> * reverted auto-formatted imports with 2 lines (.idea/webstorm) Signed-off-by: Roman <ixrock@gmail.com> * fix: handle warnings in main-process compilation files Signed-off-by: Roman <ixrock@gmail.com> * fix: handle warnings in "renderer" compilation Signed-off-by: Roman <ixrock@gmail.com> * fix: move app fonts preloading into html/css files, clean up Signed-off-by: Roman <ixrock@gmail.com> * update "webpack@5", "typescript@4.5" in bundled extensions / attempt to fix weird errors in build pipeline: ERROR in /home/runner/work/lens/lens/src/extensions/npm/extensions/dist/src/common/catalog/catalog-category-registry.d.ts 6:27-35 [tsl] ERROR in /home/runner/work/lens/lens/src/extensions/npm/extensions/dist/src/common/catalog/catalog-category-registry.d.ts(6,28) TS1005: ',' expected. ERROR in /home/runner/work/lens/lens/src/extensions/npm/extensions/dist/src/renderer/components/select/select.d.ts 8:14-28 [tsl] ERROR in /home/runner/work/lens/lens/src/extensions/npm/extensions/dist/src/renderer/components/select/select.d.ts(8,15) TS1005: ',' expected. ERROR in /home/runner/work/lens/lens/src/extensions/npm/extensions/dist/src/renderer/api/catalog-entity-registry.d.ts 8:14-22 [tsl] ERROR in /home/runner/work/lens/lens/src/extensions/npm/extensions/dist/src/renderer/api/catalog-entity-registry.d.ts(8,15) TS1005: ',' expected. Signed-off-by: Roman <ixrock@gmail.com> * fix: handle errors in bundled extensions compilation process Signed-off-by: Roman <ixrock@gmail.com> * fix: "webpack" not found in production Signed-off-by: Roman <ixrock@gmail.com> * fix: removed preloading fonts in template via <link preload> since it's not bundled with HtmlWebpackPlugin() anyway anda all fonts loaded via css @font-face rule Signed-off-by: Roman <ixrock@gmail.com> * apply HMR at least for css/styles and use manual page reload on app/scripts change Signed-off-by: Roman <ixrock@gmail.com> * use `react-refresh-typescript` and `@pmmmwh/react-refresh-webpack-plugin` to support HMR in most cases Signed-off-by: Roman <ixrock@gmail.com> * responding to comments Signed-off-by: Roman <ixrock@gmail.com> * revered extension version in package-lock.json (autoupdated on `make dev`) Signed-off-by: Roman <ixrock@gmail.com>
This commit is contained in:
1 parent
46585ee9d8
commit
d656a9e289
52 files changed
+5483
-18937
No files matched your search
@@ -11,6 +11,7 @@ import { app } from "electron";
|
||||
import type { CatalogEntitySpec } from "../catalog/catalog-entity";
|
||||
import { IpcRendererNavigationEvents } from "../../renderer/navigation/events";
|
||||
import { requestClusterActivation, requestClusterDisconnection } from "../../renderer/ipc";
|
||||
import KubeClusterCategoryIcon from "./icons/kubernetes.svg";
|
||||
|
||||
export interface KubernetesClusterPrometheusMetrics {
|
||||
address?: {
|
||||
@@ -138,7 +139,7 @@ class KubernetesClusterCategory extends CatalogCategory {
|
||||
public readonly kind = "CatalogCategory";
|
||||
public metadata = {
|
||||
name: "Clusters",
|
||||
icon: require(`!!raw-loader!./icons/kubernetes.svg`).default, // eslint-disable-line
|
||||
icon: KubeClusterCategoryIcon,
|
||||
};
|
||||
public spec: CatalogCategorySpec = {
|
||||
group: "entity.k8slens.dev",
|
||||
|
||||
@@ -3,10 +3,10 @@
|
||||
* Licensed under MIT License. See LICENSE in root directory for more information.
|
||||
*/
|
||||
|
||||
import { action, computed, observable, makeObservable } from "mobx";
|
||||
import { Disposer, ExtendedMap, iter } from "../utils";
|
||||
import { CatalogCategory, CatalogEntityData, CatalogEntityKindData } from "./catalog-entity";
|
||||
import { once } from "lodash";
|
||||
import { action, computed, makeObservable, observable } from "mobx";
|
||||
import { CatalogCategory, CatalogEntityData, CatalogEntityKindData } from "./catalog-entity";
|
||||
import { ExtendedMap, iter, type Disposer } from "../utils";
|
||||
|
||||
export type CategoryFilter = (category: CatalogCategory) => any;
|
||||
|
||||
|
||||
@@ -4,18 +4,17 @@
|
||||
*/
|
||||
|
||||
import esbuild from "esbuild";
|
||||
import type { Options as TSLoaderOptions } from "ts-loader";
|
||||
|
||||
/**
|
||||
* A function returning webpack ts/tsx loader
|
||||
*
|
||||
* depends on env LENS_DEV_USE_ESBUILD_LOADER to use esbuild-loader (faster) or good-old ts-loader
|
||||
*
|
||||
* @param testRegExp - the regex for webpack to conditional find the files
|
||||
* @returns ts/tsx webpack loader configuration object
|
||||
*/
|
||||
const getTSLoader = (
|
||||
testRegExp: RegExp, transpileOnly = true,
|
||||
) => {
|
||||
const getTSLoader = (options: Partial<TSLoaderOptions> = {}, testRegExp?: RegExp) => {
|
||||
testRegExp ??= /\.tsx?$/; // by default covers react/jsx-stuff
|
||||
options.transpileOnly ??= true;
|
||||
|
||||
if (process.env.LENS_DEV_USE_ESBUILD_LOADER === "true") {
|
||||
console.info(`\n🚀 using esbuild-loader for ts(x)`);
|
||||
|
||||
@@ -35,9 +34,7 @@ const getTSLoader = (
|
||||
exclude: /node_modules/,
|
||||
use: {
|
||||
loader: "ts-loader",
|
||||
options: {
|
||||
transpileOnly,
|
||||
},
|
||||
options,
|
||||
},
|
||||
};
|
||||
};
|
||||
|
||||
@@ -12,7 +12,8 @@ import { getAppVersion } from "../utils/app-version";
|
||||
import { kubeConfigDefaultPath } from "../kube-helpers";
|
||||
import { appEventBus } from "../app-event-bus/event-bus";
|
||||
import { getOrInsertSet, toggle, toJS } from "../../renderer/utils";
|
||||
import { DESCRIPTORS, EditorConfiguration, ExtensionRegistry, KubeconfigSyncValue, UserPreferencesModel, TerminalConfig } from "./preferences-helpers";
|
||||
import { DESCRIPTORS } from "./preferences-helpers";
|
||||
import type { EditorConfiguration, ExtensionRegistry, KubeconfigSyncValue, UserPreferencesModel, TerminalConfig } from "./preferences-helpers";
|
||||
import logger from "../../main/logger";
|
||||
|
||||
export interface UserStoreModel {
|
||||
|
||||
Reference in new issue
Block a user