forked from RobertMenke/rm-emoji-picker
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwebpack.config.js
73 lines (65 loc) · 1.68 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
61
62
63
64
65
66
67
68
69
70
71
72
73
/**
* Created by rbmenke on 1/19/17.
*/
const webpack = require( "webpack" )
const glob = require( "glob" )
const build_example = false
const is_production = true
const example_entry = {
demo: './examples/src/demo.js'
}
const lib_entry = {
EmojiPicker: './src/js/EmojiPicker.js'
}
const example_output = {
path : './examples/build/',
filename: '[name].js'
}
const lib_output = {
path : './dist/',
filename : '[name].js',
libraryTarget: "umd"
}
const dev_plugins = [
new webpack.DefinePlugin({
'process.env' : {
NODE_ENV : JSON.stringify('development')
}
})
]
const prod_plugins = [
new webpack.DefinePlugin({
'process.env' : {
NODE_ENV : JSON.stringify('production')
}
}),
new webpack.optimize.UglifyJsPlugin( {
compress: {
warnings: false
}
} )
]
module.exports = {
entry : build_example ? example_entry : lib_entry,
cache : true,
output : build_example ? example_output : lib_output,
//uncomment the devtool key for development so that webpack will provide a map to your source
devtool : is_production ? false : '#inline-source-map',
module : {
loaders: [
{
test : /\.js$/,
loader: "babel?presets[]=es2015"
},
{
test : /\.mustache$/,
loader: 'mustache?minify'
}
]
},
//Since jQuery is a peer-dependency, we leave it here as an external
externals: build_example ? {} : {
"jquery": "jquery"
},
plugins : is_production ? prod_plugins : dev_plugins
}