-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathwebpack.config.js
More file actions
63 lines (58 loc) · 1.4 KB
/
webpack.config.js
File metadata and controls
63 lines (58 loc) · 1.4 KB
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
var webpack = require("webpack");
var path = require("path");
var output = {
path:path.resolve(__dirname,"dist"),
library:"ILoading",
libraryTarget:"umd",
publicPath:"/assets/"
};
var plugins = [
new webpack.ProvidePlugin({
$:"jquery"
})
]
var config = {
entry:{
app:"./src/main.js",
},
devtool:"source-map",
resolve:{
alias:{
jquery$:path.resolve(__dirname,"lib/jquery.min.js")
}
},
module:{
rules:[
{
test:/\.scss$/,
loader:"style-loader!css-loader?minimize!sass-loader"
},
{
test:/\.js$/,
exclude:/node_modules/,
loader:"babel-loader",
query:{
presets:['es2015']
}
}
]
}
}
var NODE_ENV = process.env.NODE_ENV || "development";
if(NODE_ENV === "production"){
output.filename = "iLoading.min.js";
console.log("===========> production");
}else{
output.filename = "iLoading.js";
config.devServer = {
contentBase:path.resolve(__dirname,"./demo"),
port:9001,
compress:true,
noInfo:true,
hot:true
}
console.log("===========> development");
}
config.output = output;
config.plugins = plugins;
module.exports = config;