2019-05-28 23:27:25 +02:00
|
|
|
const path = require("path");
|
2021-04-05 07:43:30 +02:00
|
|
|
const webpack = require("webpack");
|
2019-06-23 06:11:50 +02:00
|
|
|
const CircularDependencyPlugin = require("circular-dependency-plugin");
|
2020-07-25 10:22:57 +02:00
|
|
|
const TerserPlugin = require("terser-webpack-plugin");
|
2021-04-05 07:43:30 +02:00
|
|
|
const basePkg = require("../package.json");
|
2019-05-28 23:27:25 +02:00
|
|
|
|
2019-05-29 07:00:33 +02:00
|
|
|
module.exports = {
|
|
|
|
mode: "development",
|
|
|
|
target: "node",
|
2019-06-08 08:35:43 +02:00
|
|
|
devtool: "eval-source-map",
|
2019-05-29 07:00:33 +02:00
|
|
|
entry: "./src/index.js",
|
|
|
|
output: {
|
2021-03-06 09:30:16 +01:00
|
|
|
filename: "renderer.js",
|
|
|
|
path: path.resolve(__dirname, "..", "dist")
|
2019-05-29 07:00:33 +02:00
|
|
|
},
|
|
|
|
externals: {
|
2021-04-08 02:31:02 +02:00
|
|
|
"electron": `require("electron")`,
|
|
|
|
"fs": `require("fs")`,
|
2021-04-05 07:43:30 +02:00
|
|
|
"original-fs": `require("original-fs")`,
|
2021-04-08 02:31:02 +02:00
|
|
|
"path": `require("path")`,
|
|
|
|
"request": `require("request")`,
|
|
|
|
"events": `require("events")`,
|
|
|
|
"rimraf": `require("rimraf")`,
|
|
|
|
"yauzl": `require("yauzl")`,
|
|
|
|
"mkdirp": `require("mkdirp")`
|
2019-05-29 07:00:33 +02:00
|
|
|
},
|
|
|
|
resolve: {
|
2019-05-30 07:06:17 +02:00
|
|
|
extensions: [".js", ".jsx"],
|
2020-07-24 06:07:50 +02:00
|
|
|
alias: {
|
|
|
|
modules$: path.resolve("src", "modules"),
|
|
|
|
data$: path.resolve("src", "modules"),
|
2021-03-06 09:30:16 +01:00
|
|
|
builtins$: path.resolve("src", "modules"),
|
|
|
|
common: path.resolve(__dirname, "..", "common")
|
2020-07-24 06:07:50 +02:00
|
|
|
}
|
2019-05-30 07:06:17 +02:00
|
|
|
},
|
|
|
|
module: {
|
|
|
|
rules: [
|
|
|
|
{
|
|
|
|
test: /.jsx?$/,
|
|
|
|
loader: "babel-loader",
|
|
|
|
exclude: /node_modules/,
|
|
|
|
query: {
|
|
|
|
presets: [["@babel/env", {
|
2020-07-24 06:07:50 +02:00
|
|
|
targets: {
|
2021-03-06 09:30:16 +01:00
|
|
|
node: "12.14.1",
|
2021-04-05 07:43:30 +02:00
|
|
|
chrome: "83"
|
2020-07-24 06:07:50 +02:00
|
|
|
}
|
|
|
|
}], "@babel/react"]
|
2019-05-30 07:06:17 +02:00
|
|
|
}
|
2021-03-01 01:22:45 +01:00
|
|
|
},
|
|
|
|
{
|
|
|
|
test: /\.css$/i,
|
|
|
|
use: ["css-loader", "postcss-loader"],
|
2019-05-30 07:06:17 +02:00
|
|
|
}
|
|
|
|
]
|
2019-06-23 06:11:50 +02:00
|
|
|
},
|
|
|
|
plugins: [
|
|
|
|
new CircularDependencyPlugin({
|
2020-07-23 22:51:58 +02:00
|
|
|
exclude: /node_modules/,
|
2019-06-23 06:11:50 +02:00
|
|
|
cwd: process.cwd(),
|
2021-04-05 07:43:30 +02:00
|
|
|
}),
|
|
|
|
new webpack.DefinePlugin({
|
|
|
|
"process.env.__VERSION__": JSON.stringify(basePkg.version)
|
2019-06-23 06:11:50 +02:00
|
|
|
})
|
2020-07-25 10:22:57 +02:00
|
|
|
],
|
|
|
|
optimization: {
|
|
|
|
minimizer: [
|
|
|
|
new TerserPlugin({
|
|
|
|
terserOptions: {
|
2020-07-26 11:34:38 +02:00
|
|
|
compress: {drop_debugger: false}
|
2020-07-25 10:22:57 +02:00
|
|
|
}
|
|
|
|
})
|
|
|
|
]
|
|
|
|
}
|
2019-05-28 23:27:25 +02:00
|
|
|
};
|