forked from cruise-automation/rosbag.js
-
Notifications
You must be signed in to change notification settings - Fork 0
/
webpack.config.js
39 lines (35 loc) · 1.03 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
// Copyright (c) 2018-present, Cruise LLC
// This source code is licensed under the Apache License, Version 2.0,
// found in the LICENSE file in the root directory of this source tree.
// You may not use this file except in compliance with the License.
const path = require("path");
const nodeExternals = require("webpack-node-externals");
const target = process.env.ROSBAG_TARGET || "";
module.exports = {
entry: `./src/${target}/index.ts`,
devtool: "inline-source-map",
resolve: {
extensions: [".ts", ".js"]
},
module: {
rules: [
{
test: /\.ts$/,
use: {
loader: "ts-loader",
},
exclude: /node_modules/,
},
],
},
output: {
filename: "index.js",
path: path.resolve(__dirname, `dist/${target}`),
library: "rosbag",
libraryTarget: "umd",
// https://github.com/webpack/webpack/issues/6525#issuecomment-417580843
globalObject: "typeof self !== 'undefined' ? self : this",
},
target,
externals: target === "node" ? [nodeExternals()] : undefined,
};