forked from Novage/p2p-media-loader
-
Notifications
You must be signed in to change notification settings - Fork 0
/
webpackfile.js
35 lines (32 loc) · 1.05 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
const path = require("path");
const webpack = require("webpack");
const OUTPUT_PATH = "build";
function makeConfig({libName, entry, mode}) {
return {
mode,
entry,
resolve: {
// Add `.ts` as a resolvable extension.
extensions: [".ts", ".js"]
},
module: {
rules: [
// all files with a `.ts` extension will be handled by `ts-loader`
{ test: /\.ts?$/, exclude: [/node_modules/], loader: "ts-loader" },
]
},
output: {
filename: libName + ".js",
path: path.resolve(__dirname, OUTPUT_PATH)
},
plugins: [
new webpack.DefinePlugin({
__P2PML_VERSION__: JSON.stringify(require("./package.json").version)
})
]
}
};
module.exports = [
makeConfig({entry: "./lib/browser-init-webpack.js", mode: "development", libName: "p2p-media-loader-core", }),
makeConfig({entry: "./lib/browser-init-webpack.js", mode: "production", libName: "p2p-media-loader-core.min"})
];