1
0
mirror of https://github.com/lensapp/lens.git synced 2024-11-10 10:36:25 +03:00
lens/webpack.main.ts
chh 3eeb395a78
Remove hard-source-webpack-plugin (#1305)
Signed-off-by: Hung-Han (Henry) Chen <1474479+chenhunghan@users.noreply.github.com>
2020-11-10 12:13:01 +02:00

53 lines
1.3 KiB
TypeScript
Executable File

import path from "path";
import webpack from "webpack";
import ForkTsCheckerPlugin from "fork-ts-checker-webpack-plugin"
import { isDevelopment, isProduction, mainDir, buildDir } from "./src/common/vars";
import nodeExternals from "webpack-node-externals";
import ProgressBarPlugin from "progress-bar-webpack-plugin";
export default function (): webpack.Configuration {
console.info('WEBPACK:main', require("./src/common/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(mainDir, "index.ts"),
},
output: {
libraryTarget: "global",
path: buildDir,
},
resolve: {
extensions: ['.json', '.js', '.ts']
},
externals: [
nodeExternals()
],
module: {
rules: [
{
test: /\.node$/,
use: "node-loader"
},
{
test: /\.ts$/,
exclude: /node_modules/,
use: {
loader: "ts-loader",
options: {
transpileOnly: true,
}
}
},
]
},
plugins: [
new ProgressBarPlugin(),
new ForkTsCheckerPlugin(),
].filter(Boolean)
}
}