-
Notifications
You must be signed in to change notification settings - Fork 13
/
webpack-umd.config.js
67 lines (65 loc) · 1.63 KB
/
webpack-umd.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
65
66
67
const path = require("path");
const fs = require("fs");
const webpack = require("webpack");
const webpackAngularExternals = require("webpack-angular-externals");
const webpackRxJsExternals = require("webpack-rxjs-externals");
const UglifyJsPlugin = require("uglifyjs-webpack-plugin");
const stripIndent = require("common-tags").stripIndent;
const pkg = JSON.parse(fs.readFileSync("./package.json").toString());
module.exports = {
entry: {
"ng2-md-datatable.umd": "./tmp/es5/ng2-md-datatable.es5.js",
"ng2-md-datatable.umd.min": "./tmp/es5/ng2-md-datatable.es5.js"
},
output: {
path: path.join(__dirname, "/dist/bundles"),
filename: "[name].js",
libraryTarget: "umd",
library: "ng2-md-datatable"
},
externals: [webpackAngularExternals(), webpackRxJsExternals()],
devtool: "source-map",
module: {
rules: [
{
test: /\.json$/,
use: "json-loader"
},
{
test: /\.css$/,
use: ["to-string-loader", "css-loader"]
},
{
test: /\.scss$/,
use: ["to-string-loader", "css-loader", "sass-loader"]
},
{
test: /\.html$/,
use: "raw-loader"
}
]
},
plugins: [
new webpack.BannerPlugin({
banner: stripIndent`
/**
* ${pkg.name} - ${pkg.description}
* @version v${pkg.version}
* @author ${pkg.author.name}
* @link ${pkg.homepage}
* @license ${pkg.license}
*/
`,
raw: true,
entryOnly: true
})
],
optimization: {
minimizer: [
new UglifyJsPlugin({
include: /\.min\.js$/,
sourceMap: true,
})
]
}
};