-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathwebpack.config.ts
More file actions
104 lines (96 loc) · 2.65 KB
/
Copy pathwebpack.config.ts
File metadata and controls
104 lines (96 loc) · 2.65 KB
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
import path from "path";
import dotnev from "dotenv";
import { WebBundler } from "varie-bundler";
import VarieElectronRendererPlugin from "./varie-bundler-plugins/VarieElectronRendererPlugin";
import VarieElectronMainProcessPlugin from "./varie-bundler-plugins/VarieElectronMainProcessPlugin";
const env = dotnev.config().parsed;
export default function({ mode, platform }) {
let bundles = [];
if (platform === "app") {
let main = new WebBundler(mode, {
bundleName: "main process",
webpack: {
devServer: {
open: false,
},
},
outputPath: path.join(__dirname, "dist/main"),
})
.entry("main", ["main"])
.aliases({
"@app": "app",
"@views": "views",
"@store": "store",
"@config": "config",
"@routes": "routes",
"@models": "app/models",
"@resources": "resources",
"@components": "app/components",
})
// ROBOT.JS
.chainWebpack((config) => {
config.module
.rule("node-loader")
.test(/\.node$/)
.use("node-loader")
.loader("native-addon-loader");
})
.plugin(VarieElectronMainProcessPlugin);
bundles.push(...main.build());
}
let app = new WebBundler(mode, {
bundleName: "app",
vue: {
runtimeOnly: false,
},
outputPath:
platform === "web"
? path.join(__dirname, "public")
: path.join(__dirname, "dist/renderer"),
})
.entry("renderer", ["app/app.ts", "resources/sass/app.scss"])
.aliases({
"@app": "app",
"@views": "views",
"@store": "store",
"@config": "config",
"@routes": "routes",
"@models": "app/models",
"@resources": "resources",
"@components": "app/components",
})
.varieConfig({
// @ts-ignore -- fix varie bundler
"signal-server": {
host: env.SIGNAL_SERVER_HOST,
},
"rtc-settings": {
iceServers: env.ICE_SERVERS,
},
app: {
host: env.API_HOST,
platform,
},
})
.purgeCss(["app", "views", "node_modules/varie"])
.globalSassIncludes("resources/sass/base/_variables.scss")
.aggressiveVendorSplitting()
.eslint()
.chainWebpack((config) => {
config.module
.rule("images")
.use("file-loader")
.loader("file-loader")
.tap((options) => {
options.esModule = false;
return options;
});
config.node.set("fs", "empty");
})
.globalSassIncludes("resources/sass/global_variables.scss");
if (platform === "app") {
app.plugin(VarieElectronRendererPlugin);
}
bundles.push(...app.build());
return bundles;
}