-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathwebpack.config.js
130 lines (125 loc) · 3.4 KB
/
webpack.config.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
const CopyWebpackPlugin = require("copy-webpack-plugin");
const webpack = require("webpack");
const path = require("path");
const isDev = process.env.NODE_ENV !== "production";
const outputPath = path.resolve(__dirname, "dist");
var main = {
mode: isDev ? "development" : "production",
target: "electron-main",
devtool: isDev ? "source-map" : false,
entry: path.resolve(__dirname, "src", "index"),
output: {
filename: "index.js",
path: outputPath,
},
node: {
__dirname: false,
__filename: false,
},
module: {
rules: [
{
test: /.ts?$/,
include: [path.resolve(__dirname, "src")],
exclude: [path.resolve(__dirname, "node_modules")],
loader: "ts-loader",
},
],
},
resolve: {
extensions: [".js", ".ts"],
},
plugins: [
// Module not found: Error: Can't resolve './lib-cov/fluent-ffmpeg' が出るのを防ぐ
new webpack.DefinePlugin({
"process.env.FLUENTFFMPEG_COV": false,
}),
new CopyWebpackPlugin({
patterns: [
{
from: path.resolve(__dirname, "src", "renderer", "index.html"),
},
{
from: path.resolve(__dirname, "images"),
to: path.resolve(outputPath, "images"),},
],
}),
],
};
var renderer = {
mode: isDev ? "development" : "production",
target: "electron-renderer",
entry: path.resolve(__dirname, "src", "renderer", "index"),
devtool: isDev ? "inline-source-map" : false,
output: {
filename: "index.js",
path: path.resolve(outputPath, "scripts"),
},
resolve: {
extensions: [".json", ".js", ".jsx", ".css", ".ts", ".tsx"],
},
module: {
rules: [
{
test: /\.(tsx|ts)$/,
use: ["ts-loader"],
include: [
path.resolve(__dirname, "src"),
path.resolve(__dirname, "node_modules"),
],
},
],
},
plugins: [
// Module not found: Error: Can't resolve './lib-cov/fluent-ffmpeg' が出るのを防ぐ
new webpack.DefinePlugin({
"process.env.FLUENTFFMPEG_COV": false,
}),
],
};
// var worker = {
// mode: isDev ? "development" : "production",
// target: "electron-renderer",
// entry: path.resolve(__dirname, "src", "renderer", "WebWorker", "index"),
// devtool: isDev ? "inline-source-map" : false,
// output: {
// filename: "worker.js",
// path: path.resolve(outputPath, "scripts")
// },
// resolve: {
// extensions: [".json", ".js", ".ts"]
// },
// module: {
// rules: [
// {
// test: /\.ts/,
// use: ["ts-loader"],
// include: [
// path.resolve(__dirname, "src"),
// path.resolve(__dirname, "node_modules")
// ]
// }
// ]
// },
// plugins: [
// // Module not found: Error: Can't resolve './lib-cov/fluent-ffmpeg' が出るのを防ぐ
// new webpack.DefinePlugin({
// "process.env.FLUENTFFMPEG_COV": false
// }),
// new CopyWebpackPlugin([
// // {
// // from: path.resolve(__dirname, "node_modules", "jsgif", "GIFEncoder.js")
// // },
// // {
// // from: path.resolve(__dirname, "node_modules", "jsgif", "LZWEncoder.js")
// // },
// // {
// // from: path.resolve(__dirname, "node_modules", "jsgif", "NeuQuant.js")
// // },
// // {
// // from: path.resolve(__dirname, "node_modules", "jsgif", "b64.js")
// // }
// ])
// ]
// };
module.exports = [main, renderer];