forked from Novage/p2p-media-loader
-
Notifications
You must be signed in to change notification settings - Fork 0
/
webpackfile.js
46 lines (43 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
46
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),
},
plugins: [
new webpack.ProvidePlugin({
Buffer: ["buffer", "Buffer"],
process: "process/browser",
}),
],
};
}
module.exports = [
makeConfig({
entry: "./lib/browser-init-webpack.ts",
mode: "development",
libName: "p2p-media-loader-core",
}),
makeConfig({
entry: "./lib/browser-init-webpack.ts",
mode: "production",
libName: "p2p-media-loader-core.min",
}),
];