-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathwebpack.config.js
64 lines (59 loc) · 1.5 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
/**
* Copyright 2019 the orbs-client-sdk-javascript authors
* This file is part of the orbs-client-sdk-javascript library in the Orbs project.
*
* This source code is licensed under the MIT license found in the LICENSE file in the root directory of this source tree.
* The above notice should be included in all copies or substantial portions of the software.
*/
const path = require("path");
const production = process.env.NODE_ENV === "production";
const libraryName = 'Orbs';
const webConfig = {
target: 'web',
mode: production ? "production" : "development",
devtool: production ? "" : "inline-source-map",
entry: "./src/index.ts",
output: {
path: path.join(__dirname, "dist"),
filename: `orbs-client-sdk-web.js`,
library: libraryName,
libraryTarget: "umd",
umdNamedDefine: true
},
resolve: {
extensions: [".js", ".ts"],
},
module: {
rules: [
{
test: /\.ts$/,
loaders: ["babel-loader"],
},
],
},
};
const nodeConfig = {
target: 'node',
mode: production ? "production" : "development",
devtool: production ? "" : "inline-source-map",
entry: "./src/index.ts",
output: {
path: path.join(__dirname, "dist"),
filename: `orbs-client-sdk.js`,
library: libraryName,
libraryTarget: "umd",
umdNamedDefine: true
},
resolve: {
extensions: [".js", ".ts"],
},
module: {
rules: [
{
test: /\.ts$/,
loaders: ["babel-loader"],
},
],
},
};
module.exports = [webConfig, nodeConfig];