forked from lgarron/clipboard-polyfill
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwebpack.config.js
42 lines (38 loc) · 1.09 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
40
41
42
var BundleAnalyzerPlugin = require("webpack-bundle-analyzer").BundleAnalyzerPlugin;
var path = require("path");
var webpack = require("webpack");
var WebpackNotifierPlugin = require("webpack-notifier");
var PROD = JSON.parse(process.env.PROD || false);
var BUNDLE_ANALYZER = JSON.parse(process.env.BUNDLE_ANALYZER || false);
module.exports = {
entry: {
"clipboard-polyfill": "./clipboard-polyfill.ts",
"clipboard-polyfill.promise": ["es6-promise/dist/es6-promise.auto.js", "./clipboard-polyfill.ts"]
},
module: {
rules: [
{ test: /\.ts$/, use: "ts-loader" }
]
},
output: {
path: __dirname + "/build",
filename: "[name].js",
library: "clipboard",
libraryTarget: "umd"
},
resolve: {
extensions: [".ts"],
modules: ["node_modules"]
},
plugins: [
new WebpackNotifierPlugin({alwaysNotify: true})
]
};
if (BUNDLE_ANALYZER) {
module.exports.plugins.push(new BundleAnalyzerPlugin());
}
if (PROD) {
module.exports.plugins.push(new webpack.optimize.UglifyJsPlugin({sourceMap: false}));
} else {
module.exports.devtool = "source-map";
}