BetterDiscordApp-rauenzi/renderer/webpack.config.js

75 lines
1.8 KiB
JavaScript
Raw Normal View History

2019-05-28 23:27:25 +02:00
const path = require("path");
const webpack = require("webpack");
const CircularDependencyPlugin = require("circular-dependency-plugin");
const TerserPlugin = require("terser-webpack-plugin");
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: {
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")`,
"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"],
alias: {
modules$: path.resolve("src", "modules"),
data$: path.resolve("src", "modules"),
builtins$: path.resolve("src", "modules"),
common: path.resolve(__dirname, "..", "common")
}
2019-05-30 07:06:17 +02:00
},
module: {
rules: [
{
test: /.jsx?$/,
loader: "babel-loader",
exclude: /node_modules/,
query: {
presets: [["@babel/env", {
targets: {
node: "12.14.1",
chrome: "83"
}
}], "@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
}
]
},
plugins: [
new CircularDependencyPlugin({
2020-07-23 22:51:58 +02:00
exclude: /node_modules/,
cwd: process.cwd(),
}),
new webpack.DefinePlugin({
"process.env.__VERSION__": JSON.stringify(basePkg.version)
})
],
optimization: {
minimizer: [
new TerserPlugin({
terserOptions: {
compress: {drop_debugger: false}
}
})
]
}
2019-05-28 23:27:25 +02:00
};