-
Notifications
You must be signed in to change notification settings - Fork 0
/
webpack.dev.config.js
115 lines (94 loc) · 2.54 KB
/
webpack.dev.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
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
var path = require("path"),
webpack = require("webpack"),
proxy = require("./proxy");
var SRC_PATH = path.join(__dirname, 'src'),
DIST_PATH = path.join(__dirname, '../static');
var HtmlWebpackPlugin = require('html-webpack-plugin'),
ExtractTextPlugin = require("extract-text-webpack-plugin");
var config = {
devtool: 'source-map',
entry: {
apps: path.join(SRC_PATH, 'root.js'),
vendors: [
'vue',
'vuex',
'vue-router',
'vuex-router-sync',
'whatwg-fetch',
'es6-promise',
'querystring'
]
},
resolve: {
alias: {},
extensions: ["", ".less", ".css", ".js", ".vue", ".json"]
},
output: {
path: DIST_PATH,
publicPath: '',
filename: "js/[name].js"
},
clearBeforeBuild: false,
plugins: [
new webpack.optimize.CommonsChunkPlugin(
'vendors',
'js/vendors.js', // vendor date
Infinity
),
new ExtractTextPlugin(`css/commons.css`, {allChunks: true}),
new webpack.DefinePlugin({
'process.env.NODE_ENV': JSON.stringify('development'),
'__DEV__': true
}),
new HtmlWebpackPlugin({
inject: false,
filename: './index.html',
template: path.join(SRC_PATH, 'index.html'),
"files": {
"css": ["css/commons.css"]
}
})
],
module: {
noParse: [],
loaders: [
{
test: /\.vue$/,
loader: 'vue'
}, {
test: /\.js$/,
loader: "babel",
include: SRC_PATH
},
{
test: /\.css$/,
loader: "style!css!autoprefixer"
},
{
test: /\.scss$/,
loader: "style!css!autoprefixer!sass"
},
{
test: /\.(png|jpg|gif)$/,
loader: "url",
query: {
limit: 8192,
name: 'imgs/[name].[ext]'
}
},
{
test: /\.(eot|woff|woff2|ttf|svg)/,
loader: "url",
query: {
limit: 100,
name: 'fonts/[name].[ext]'
}
}
]
},
devServer: {
proxy: proxy
}
};
console.log("initializing webpack developent build....");
module.exports = config;