Files
backup/webpack.electron.js
T

60 lines
2.1 KiB
JavaScript
Raw Normal View History

2022-07-09 01:37:19 -07:00
const path = require("path");
const CopyPlugin = require("copy-webpack-plugin");
2022-07-09 01:37:19 -07:00
module.exports = {
mode: "development",
entry: {
2023-10-05 11:25:32 -07:00
emain: ["./src/electron/emain.ts"],
2022-07-09 01:37:19 -07:00
},
target: "electron-main",
output: {
path: path.resolve(__dirname, "dist-dev"),
2023-08-21 21:37:04 -07:00
filename: "[name].js",
2022-07-09 01:37:19 -07:00
},
externals: {
2023-08-21 21:37:04 -07:00
fs: "require('fs')",
2022-07-09 01:37:19 -07:00
"fs-ext": "require('fs-ext')",
},
module: {
rules: [
{
test: /\.tsx?$/,
// exclude: /node_modules/,
use: {
loader: "babel-loader",
options: {
presets: [
[
"@babel/preset-env",
{
2023-08-21 21:37:04 -07:00
targets:
"defaults and not ie > 0 and not op_mini all and not op_mob > 0 and not kaios > 0 and not and_qq > 0 and not and_uc > 0 and not baidu > 0",
2022-07-09 01:37:19 -07:00
},
],
"@babel/preset-react",
2023-08-21 21:37:04 -07:00
"@babel/preset-typescript",
],
2022-07-09 01:37:19 -07:00
plugins: [
2023-08-21 21:37:04 -07:00
["@babel/transform-runtime", { regenerator: true }],
2022-07-09 01:37:19 -07:00
"@babel/plugin-transform-react-jsx",
2023-08-21 21:37:04 -07:00
["@babel/plugin-proposal-decorators", { legacy: true }],
["@babel/plugin-proposal-class-properties", { loose: true }],
["@babel/plugin-proposal-private-methods", { loose: true }],
["@babel/plugin-proposal-private-property-in-object", { loose: true }],
2022-07-09 01:37:19 -07:00
"babel-plugin-jsx-control-statements",
],
},
},
},
2023-08-21 21:37:04 -07:00
],
2022-07-09 01:37:19 -07:00
},
plugins: [
new CopyPlugin({
2023-10-05 11:25:32 -07:00
patterns: [{ from: "src/electron/preload.js", to: "preload.js" }],
}),
],
2022-07-09 01:37:19 -07:00
resolve: {
2023-08-21 21:37:04 -07:00
extensions: [".ts", ".tsx", ".js"],
2022-07-09 01:37:19 -07:00
},
2023-08-21 21:37:04 -07:00
};