-
-
Notifications
You must be signed in to change notification settings - Fork 41
/
webpack.rpc_client.config.js
53 lines (51 loc) · 1.71 KB
/
webpack.rpc_client.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
/*
* File: webpack.rpc_client.config.js
* Project: discord-rpc
* File Created: Thursday, 11th May 2023 1:23:48 pm
* Author: Tee ([email protected])
* Github: https://github.com/teeteeteeteetee
* Discord: Tee#0001
*
* Last Modified: Saturday, 25th November 2023 2:49:42 pm
* Modified By: Tee ([email protected])
*
* Copyright (c) 2023 Tee, Stainless Love
*/
const nodeExternals = require('webpack-node-externals')
const path = require('path');
const pluginConfig = require('../pluginrc.js')
// const distFolder = pluginConfig.destinationFolder
const distFolder = path.join(pluginConfig.destinationFolder, pluginConfig.extensionBundleId)
const srcFolder = pluginConfig.sourceFolder
const CLIENT_DIST_PATH = path.resolve(distFolder, 'rpc_client-dist')
const CLIENT_DIST_SRC = path.resolve(distFolder, 'rpc_client-src')
const ENTRY_POINT_CLIENT_PATH = path.join(srcFolder, 'rpc_client-src/index.js')
module.exports = {
mode: 'development',
target: 'node7.0',
// target: 'node',
externals: [nodeExternals({modulesDir: path.join(CLIENT_DIST_SRC, 'node_modules')})],
entry: ['babel-polyfill', ENTRY_POINT_CLIENT_PATH],
output: {
path: CLIENT_DIST_PATH,
filename: 'bundle.js',
libraryTarget: 'commonjs2'
},
module: {
rules: [{
test: /\.js$/,
use: {
loader: 'babel-loader',
options: {
presets: [
['env', {
'targets': {
'node': 'current'
}
}]
],
},
}
}]
}
}