-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathwebpack.config.js
More file actions
41 lines (39 loc) · 998 Bytes
/
webpack.config.js
File metadata and controls
41 lines (39 loc) · 998 Bytes
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
var webpack = require ("webpack");
var path = require ("path");
var fs = require ("fs");
var UglifyJsPlugin = require ("uglifyjs-webpack-plugin");
const packageJSON = JSON.parse (
fs.readFileSync (path.resolve (__dirname, "package.json"), "utf8")
);
module.exports = {
entry: [ path.resolve (__dirname, "src", "index.js") ],
output: {
path: path.resolve (__dirname, "lib"),
filename: "index.js",
libraryTarget: "commonjs2"
},
target: "node",
resolve: {
extensions: [ "*", ".js" ]
},
externals: Object.keys (
Object.assign ({}, packageJSON.peerDependencies, packageJSON.dependencies)
).reduce (function (previous, key) {
return Object.assign ({}, previous, {
[key]: key
});
}, {}),
plugins: [
new webpack.BannerPlugin ({ banner: "#!/usr/bin/env node", raw: true }),
new UglifyJsPlugin ()
],
module: {
rules: [
{
test: /\.js/,
exclude: /node_modules/,
loader: "babel-loader"
}
]
}
};