1
0
mirror of https://github.com/lensapp/lens.git synced 2025-05-20 05:10:56 +00:00
lens/webpack/main.ts
Sebastian Malton ed073d6562
Revert "Remove mac-ca usage since it was only in tests (#6043)" (#6319)
This reverts commit f544386619.

Signed-off-by: Sebastian Malton <sebastian@malton.name>

Signed-off-by: Sebastian Malton <sebastian@malton.name>
2022-10-04 17:52:55 -04:00

67 lines
1.8 KiB
TypeScript
Executable File

/**
* Copyright (c) OpenLens Authors. All rights reserved.
* Licensed under MIT License. See LICENSE in root directory for more information.
*/
import path from "path";
import type webpack from "webpack";
import ForkTsCheckerPlugin from "fork-ts-checker-webpack-plugin";
import nodeExternals from "webpack-node-externals";
import getTypeScriptLoader from "./get-typescript-loader";
import CircularDependencyPlugin from "circular-dependency-plugin";
import { iconsAndImagesWebpackRules } from "./renderer";
import type { WebpackPluginInstance } from "webpack";
import { buildDir, isDevelopment, mainDir } from "./vars";
const configs: { (): webpack.Configuration }[] = [];
configs.push((): webpack.Configuration => {
console.info("WEBPACK:main", {
isDevelopment,
mainDir,
buildDir,
});
return {
name: "lens-app-main",
context: __dirname,
target: "electron-main",
mode: isDevelopment ? "development" : "production",
devtool: isDevelopment ? "cheap-module-source-map" : "source-map",
cache: isDevelopment ? { type: "filesystem" } : false,
entry: {
main: path.resolve(mainDir, "index.ts"),
},
output: {
libraryTarget: "global",
path: buildDir,
},
resolve: {
extensions: [".json", ".js", ".ts"],
},
externals: [
nodeExternals(),
],
module: {
rules: [
{
test: /\.node$/,
use: "node-loader",
},
getTypeScriptLoader({}, /\.ts$/),
...iconsAndImagesWebpackRules(),
],
},
plugins: [
new ForkTsCheckerPlugin(),
new CircularDependencyPlugin({
cwd: __dirname,
exclude: /node_modules/,
failOnError: true,
}) as unknown as WebpackPluginInstance,
],
};
});
export default configs;