-
Notifications
You must be signed in to change notification settings - Fork 0
/
webpack.main.config.ts
59 lines (54 loc) · 1.48 KB
/
webpack.main.config.ts
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
import type { Configuration } from 'webpack';
import { join, resolve } from "node:path";
import { WebpackPluginInstance } from "webpack";
import { platform } from "node:os";
import { rules } from './webpack.rules';
import { plugins } from './webpack.plugins';
import CopyPlugin from "copy-webpack-plugin";
import CopyFileWebpackPlugin from "./util/CopyFileWebpackPlugin";
const mainPlugins: WebpackPluginInstance[] = plugins.slice();
if (process.env.APP_MODE === "dev") {
const extension = platform() === "win32" ? ".exe" : "";
mainPlugins.push(
new CopyFileWebpackPlugin({
sourcePath: join(__dirname, "node_modules", "ffmpeg-static", "ffmpeg" + extension),
permissions: 0o755
})
);
}
mainPlugins.push(new CopyPlugin({
patterns: [
{
from: join(__dirname, "node_modules", "fluent-ffmpeg"),
to: "fluent-ffmpeg"
},
],
}))
export const mainConfig: Configuration = {
/**
* This is the main entry point for your application, it's the first file
* that runs in the main process.
*/
entry: {
index: './src/index.ts',
"worker-pool": './src/workers/worker-pool.ts',
worker: './src/workers/worker.ts'
},
// Put your normal webpack config below here
module: {
rules,
},
plugins: mainPlugins,
resolve: {
extensions: ['.js', '.ts', '.jsx', '.tsx', '.css', '.json'],
alias: {
app: resolve(__dirname, "src/")
}
},
output: {
filename: '[name].js'
},
externals: {
'fluent-ffmpeg': 'fluent-ffmpeg'
}
};