-
Notifications
You must be signed in to change notification settings - Fork 32
/
webpack-api.config.js
53 lines (51 loc) · 1.71 KB
/
webpack-api.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
const path = require("path");
const config = {
entry: {
"api-account-recovery": path.resolve(__dirname, "./src/react-extension/ApiAccountRecovery.entry.js"), // The account recovery application served by the API
"api-app": path.resolve(__dirname, "./src/react-extension/ApiApp.entry.js"), // The passbolt application served by the API
"api-recover": path.resolve(__dirname, "./src/react-extension/ApiRecover.entry.js"), // The recover application served by the API
"api-setup": path.resolve(__dirname, "./src/react-extension/ApiSetup.entry.js"), // The setup application served by the API
"api-triage": path.resolve(__dirname, "./src/react-extension/ApiTriage.entry.js"), // The triage application served by the API
"api-feedback": path.resolve(__dirname, "./src/react-extension/ApiFeedback.entry.js"), // The feedback application served by the API
},
mode: "production",
module: {
rules: [
{
test: /\.(js|jsx)$/,
exclude: /(node_modules|bower_components)/,
loader: "babel-loader",
options: {
presets: ["@babel/react"],
}
},
{test: /\.json$/, loader: 'json-loader'}
]
},
optimization: {
splitChunks: {
cacheGroups: {
commons: {
test: /[\\/]node_modules[\\/]/,
name: "api-vendors",
chunks: "all"
},
}
},
},
resolve: {extensions: ["*", ".js", ".jsx"]},
output: {
path: path.resolve(__dirname, "build/js/dist/"),
pathinfo: true,
filename: "[name].js"
},
};
exports.default = function (env) {
env = env || {};
// Enable debug mode.
if (env.debug) {
config.mode = "development";
config.devtool = "inline-source-map";
}
return config;
};