mirror of
https://github.com/lensapp/lens.git
synced 2024-12-01 10:37:09 +03:00
chore: Run lint on webpack/renderer
Signed-off-by: Sebastian Malton <sebastian@malton.name>
This commit is contained in:
parent
91354eae01
commit
700a9024a8
@ -1,23 +1,30 @@
|
|||||||
/**
|
/**
|
||||||
* Copyright (c) OpenLens Authors. All rights reserved.
|
* Copyright (c) OpenLens Authors. All rights reserved.
|
||||||
* Licensed under MIT License. See LICENSE in root directory for more information.
|
* Licensed under MIT License. See LICENSE in root directory for more information.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import path from "path";
|
import path from "path";
|
||||||
import type webpack from "webpack";
|
import type webpack from "webpack";
|
||||||
import HtmlWebpackPlugin from "html-webpack-plugin";
|
import HtmlWebpackPlugin from "html-webpack-plugin";
|
||||||
import MiniCssExtractPlugin from "mini-css-extract-plugin";
|
import MiniCssExtractPlugin from "mini-css-extract-plugin";
|
||||||
import ForkTsCheckerPlugin from "fork-ts-checker-webpack-plugin";
|
import ForkTsCheckerPlugin from "fork-ts-checker-webpack-plugin";
|
||||||
import MonacoWebpackPlugin from "monaco-editor-webpack-plugin";
|
import MonacoWebpackPlugin from "monaco-editor-webpack-plugin";
|
||||||
import CircularDependencyPlugin from "circular-dependency-plugin";
|
import CircularDependencyPlugin from "circular-dependency-plugin";
|
||||||
import ReactRefreshWebpackPlugin from "@pmmmwh/react-refresh-webpack-plugin";
|
import ReactRefreshWebpackPlugin from "@pmmmwh/react-refresh-webpack-plugin";
|
||||||
import CopyPlugin from "copy-webpack-plugin";
|
import CopyPlugin from "copy-webpack-plugin";
|
||||||
import type { WebpackPluginInstance } from "webpack";
|
import type { WebpackPluginInstance } from "webpack";
|
||||||
import { DefinePlugin } from "webpack";
|
import { DefinePlugin } from "webpack";
|
||||||
import { assetsFolderName, isDevelopment, rendererDir, buildDir, htmlTemplate, publicPath } from "./vars";
|
import {
|
||||||
import corePackageJson from "@k8slens/core/package.json";
|
assetsFolderName,
|
||||||
|
isDevelopment,
|
||||||
|
rendererDir,
|
||||||
|
buildDir,
|
||||||
|
htmlTemplate,
|
||||||
|
publicPath,
|
||||||
|
} from "./vars";
|
||||||
|
import corePackageJson from "@k8slens/core/package.json";
|
||||||
|
|
||||||
const renderer: webpack.Configuration = {
|
const renderer: webpack.Configuration = {
|
||||||
target: "electron-renderer",
|
target: "electron-renderer",
|
||||||
name: "lens-app-renderer",
|
name: "lens-app-renderer",
|
||||||
mode: isDevelopment ? "development" : "production",
|
mode: isDevelopment ? "development" : "production",
|
||||||
@ -45,15 +52,9 @@
|
|||||||
/\[ReactRefreshPlugin] .*?HMR.*? is not enabled/, // enabled in webpack.dev-server
|
/\[ReactRefreshPlugin] .*?HMR.*? is not enabled/, // enabled in webpack.dev-server
|
||||||
],
|
],
|
||||||
resolve: {
|
resolve: {
|
||||||
extensions: [
|
extensions: [".js", ".jsx", ".json", ".ts", ".tsx"],
|
||||||
".js", ".jsx", ".json",
|
|
||||||
".ts", ".tsx",
|
|
||||||
],
|
|
||||||
},
|
},
|
||||||
externals: [
|
externals: ["npm", "win-ca"],
|
||||||
"npm",
|
|
||||||
"win-ca"
|
|
||||||
],
|
|
||||||
optimization: {
|
optimization: {
|
||||||
minimize: false,
|
minimize: false,
|
||||||
},
|
},
|
||||||
@ -126,19 +127,15 @@
|
|||||||
],
|
],
|
||||||
}),
|
}),
|
||||||
|
|
||||||
...(
|
...(isDevelopment ? [new ReactRefreshWebpackPlugin()] : []),
|
||||||
isDevelopment
|
|
||||||
? [new ReactRefreshWebpackPlugin()]
|
|
||||||
: []
|
|
||||||
),
|
|
||||||
],
|
],
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Import icons and image files.
|
* Import icons and image files.
|
||||||
* Read more about asset types: https://webpack.js.org/guides/asset-modules/
|
* Read more about asset types: https://webpack.js.org/guides/asset-modules/
|
||||||
*/
|
*/
|
||||||
export function iconsAndImagesWebpackRules(): webpack.RuleSetRule[] {
|
export function iconsAndImagesWebpackRules(): webpack.RuleSetRule[] {
|
||||||
return [
|
return [
|
||||||
{
|
{
|
||||||
test: /\.svg$/,
|
test: /\.svg$/,
|
||||||
@ -152,12 +149,12 @@
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Import custom fonts as URL.
|
* Import custom fonts as URL.
|
||||||
*/
|
*/
|
||||||
export function fontsLoaderWebpackRules(): webpack.RuleSetRule[] {
|
export function fontsLoaderWebpackRules(): webpack.RuleSetRule[] {
|
||||||
return [
|
return [
|
||||||
{
|
{
|
||||||
test: /\.(ttf|eot|woff2?)$/,
|
test: /\.(ttf|eot|woff2?)$/,
|
||||||
@ -167,19 +164,19 @@
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface CssModulesWebpackRuleOptions {
|
export interface CssModulesWebpackRuleOptions {
|
||||||
styleLoader?: string;
|
styleLoader?: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Import CSS or SASS styles with modules support (*.module.scss)
|
* Import CSS or SASS styles with modules support (*.module.scss)
|
||||||
*/
|
*/
|
||||||
export function cssModulesWebpackRule({ styleLoader }: CssModulesWebpackRuleOptions = {}): webpack.RuleSetRule {
|
export function cssModulesWebpackRule({
|
||||||
styleLoader ??= isDevelopment
|
styleLoader,
|
||||||
? "style-loader"
|
}: CssModulesWebpackRuleOptions = {}): webpack.RuleSetRule {
|
||||||
: MiniCssExtractPlugin.loader;
|
styleLoader ??= isDevelopment ? "style-loader" : MiniCssExtractPlugin.loader;
|
||||||
|
|
||||||
return {
|
return {
|
||||||
test: /\.s?css$/,
|
test: /\.s?css$/,
|
||||||
@ -198,6 +195,6 @@
|
|||||||
},
|
},
|
||||||
],
|
],
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
export default renderer;
|
export default renderer;
|
||||||
|
Loading…
Reference in New Issue
Block a user