-
Notifications
You must be signed in to change notification settings - Fork 104
/
Copy pathwebpack.config.js
53 lines (52 loc) · 1.43 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
43
44
45
46
47
48
49
50
51
52
53
// https://webpack.js.org/configuration/
const minimize = process.env.MIN ? true : false;
let webpack = require('webpack'),
path = require('path'),
pkg = require("./package.json"),
banner =
'\n' +
pkg.name + ' - ' + pkg.version + '\n' +
pkg.author + '\n' +
pkg.homepage + '\n' +
'Under ' + pkg.license + ' license \n' +
'\n',
fileName = pkg.name + ".js",
plugins = [
new webpack.BannerPlugin(banner),
new webpack.DefinePlugin({
__VERSION__: JSON.stringify(pkg.version)
})
];
if (minimize) {
plugins.push(new webpack.optimize.UglifyJsPlugin());
fileName = pkg.name + ".min.js";
}
module.exports = {
entry: "./src/init.js", // string | object | array
output: {
library: "persianDate",
libraryTarget: "umd2",
path: path.resolve(__dirname, "dist"), // string
filename: fileName // string
},
module: {
rules: [
{
test: /\.js$/,
include: [
path.resolve(__dirname, "./src")
],
exclude: [
path.resolve(__dirname, "./node_module")
],
use: {
loader: 'babel-loader',
options: {
presets: ['es2015']
}
}
}
]
},
plugins: plugins
}