forked from zerebos/BDPluginLibrary
-
Notifications
You must be signed in to change notification settings - Fork 0
/
webpack.config.js
47 lines (46 loc) · 1.33 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
const path = require("path");
const webpack = require("webpack");
const pkg = require("./package.json");
// const BundleAnalyzerPlugin = require("webpack-bundle-analyzer").BundleAnalyzerPlugin;
module.exports = env => {
return {
mode: "development",
target: "node",
devtool: "none",
entry: "./src/index.js",
output: {
filename: "PluginLibrary.js",
path: path.resolve(__dirname, "release"),
library: "ZeresPluginLibrary",
libraryTarget: "commonjs2",
libraryExport: "default"
},
externals: {
electron: `window.require("electron")`,
fs: `window.require("fs")`,
path: `window.require("path")`,
request: `window.require("request")`
},
resolve: {
extensions: [".js"],
modules: [
path.resolve("src", "modules"),
path.resolve("src", "structs"),
path.resolve("src", "ui")
]
},
module: {
rules: [{test: /\.css$/, use: "raw-loader"}]
},
plugins: [
new webpack.DefinePlugin({
"process.env": {
PLUGIN_NAME: JSON.stringify(env ? env.PLUGIN_NAME : "0PluginLibrary"),
CONFIG_PATH: JSON.stringify(env ? env.CONFIG_PATH : ""),
PLUGIN_PATH: JSON.stringify(env ? env.PLUGIN_PATH : ""),
__LIBRARY_VERSION__: JSON.stringify(pkg.version)
}
})
]
};
};