-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwebpack.config.js
68 lines (65 loc) · 1.48 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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
const webpack = require("webpack");
const CopyPlugin = require("copy-webpack-plugin");
const SOURCE_VERSION =
process.env.SOURCE_VERSION || process.env.npm_package_gitHead || "dev";
module.exports = (env) => {
let outputPath = __dirname + "/public";
let path = "src";
let mode = "development";
let devtool = "source-map";
if (env.rust) {
outputPath = __dirname + "/../rust_bpmn_analyzer/webserver/public";
mode = "production";
devtool = false;
}
if (env.ghPages) {
outputPath = __dirname + "/docs/";
mode = "production";
devtool = false;
}
return {
entry: {
bundle: [`./${path}/app.js`],
},
output: {
path: outputPath,
filename: "app.js",
},
module: {
rules: [
{
test: /\.bpmn$/,
use: "raw-loader",
},
{
test: /\.css$/i,
use: ["style-loader", "css-loader"],
},
],
},
plugins: [
new CopyPlugin({
patterns: [
{
from: "**/*.{html,css,woff,ttf,eot,svg,woff2,ico}",
context: `${path}/`,
},
],
}),
new CopyPlugin({
patterns: [
{ from: "src/index.html", to: "." },
{
from: "node_modules/bpmn-js/dist/assets",
to: ".",
},
],
}),
new webpack.DefinePlugin({
"process.env.SOURCE_VERSION": JSON.stringify(SOURCE_VERSION || null),
}),
],
mode,
devtool,
};
};