1
0
mirror of https://github.com/lensapp/lens.git synced 2024-09-21 14:27:46 +03:00
lens/webpack.main.ts
Sebastian Malton 295333d055
add progress bar for webpack compilation (#794)
Signed-off-by: Sebastian Malton <smalton@mirantis.com>

Co-authored-by: Sebastian Malton <smalton@mirantis.com>
2020-09-08 08:44:34 -04:00

57 lines
1.4 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: {
path: buildDir,
},
resolve: {
extensions: ['.json', '.js', '.ts']
},
node: {
// webpack modifies node internals by default, keep as is for main-process
__dirname: false,
__filename: false,
},
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(),
]
}
}