forked from Novage/p2p-media-loader
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwebpackfile.js
45 lines (42 loc) · 1.07 KB
/
webpackfile.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
const path = require("path");
const webpack = require("webpack");
const OUTPUT_PATH = "build";
function makeConfig({ libName, entry, mode }) {
return {
mode,
entry,
resolve: {
extensions: [".ts", ".js"],
},
module: {
rules: [
{
test: /\.ts$/,
use: "ts-loader",
exclude: /node_modules/,
},
],
},
output: {
filename: libName + ".js",
path: path.resolve(__dirname, OUTPUT_PATH),
},
externals: {
"p2p-media-loader-core": "window.p2pml.core",
debug: "window.p2pml._shared.debug",
events: "window.p2pml._shared.events",
},
};
}
module.exports = [
makeConfig({
entry: "./lib/browser-init.ts",
mode: "development",
libName: "p2p-media-loader-shaka",
}),
makeConfig({
entry: "./lib/browser-init.ts",
mode: "production",
libName: "p2p-media-loader-shaka.min",
}),
];