forked from project-slippi/slippi-launcher
-
Notifications
You must be signed in to change notification settings - Fork 0
/
webpack.main.additions.js
33 lines (28 loc) · 960 Bytes
/
webpack.main.additions.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
const TsconfigPathsPlugin = require("tsconfig-paths-webpack-plugin");
const ThreadsPlugin = require("threads-plugin");
const Dotenv = require("dotenv-webpack");
module.exports = function (context) {
// Enforce chunkhash when building output files.
// Without this we get the following error when building workers:
// Conflict: Multiple assets emit to the same filename: 0.bundle.worker.js
context.output.chunkFilename = "[id].[chunkhash].js";
// Ensure our custom paths can be resolved
context.resolve.plugins = [new TsconfigPathsPlugin()];
context.module.rules.unshift({
test: /\.node$/,
use: {
loader: "native-ext-loader",
options: {
rewritePath: undefined,
name: "[path][name].[ext]",
},
},
});
context.plugins.unshift(
// Add threads worker support
new ThreadsPlugin({ target: "electron-node-worker" }),
// Expose dotenv variables
new Dotenv(),
);
return context;
};