-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwebpack.config.js
60 lines (55 loc) · 1.49 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
54
55
56
57
58
59
60
var path = require('path'),
webpack = require('webpack');
var version = require('./package.json').version;
var isProd = process.env.NODE_ENV === 'production';
var banner =
'/*!\n' +
' * React Form Validation v' + version + '\n' +
' * (c) ' + new Date().getFullYear() + ' romagny13\n' +
' * Released under the MIT License.\n' +
' */';
var plugins = [];
plugins.push(new webpack.BannerPlugin({
banner: banner,
raw: true,
entryOnly: true,
}));
if (isProd) {
plugins.push(new webpack.LoaderOptionsPlugin({
minimize: true,
debug: false
}));
plugins.push(new webpack.optimize.UglifyJsPlugin({
beautify: false,
mangle: {
screw_ie8: true,
keep_fnames: true
},
compress: {
screw_ie8: true
},
comments: false,
sourceMap: false
}));
}
module.exports = {
entry: './src/index.js',
output: {
path: path.resolve(__dirname, "./lib/dist"),
publicPath: "/lib/dist/",
filename: isProd ? 'react-form-validation.min.js' : 'react-form-validation.js',
libraryTarget: 'umd',
library: 'ReactFormValidation'
},
devtool: isProd ? false : 'source-map',
module: {
rules: [
{ test: /\.(js|jsx)$/, exclude: [/node_modules/], use: "babel-loader" },
{ test: /\.css$/, use: ["style-loader", "css-loader"] }
]
},
resolve: {
extensions: [".js", ".jsx"]
},
plugins: plugins
};