-
Notifications
You must be signed in to change notification settings - Fork 3
/
webpack.config.js
53 lines (49 loc) · 1.52 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
var webpack = require('webpack');
var commonsPlugin = new webpack.optimize.CommonsChunkPlugin('common', 'common.js');
var path = require('path');
var publicPath = 'http://localhost:1024/dist';
var hotMiddlewareScript = 'webpack-hot-middleware/client?reload=true';
// console.log(__dirname)
var devConfig = {
// 插件项
plugins: [
new webpack.optimize.OccurenceOrderPlugin(),
new webpack.HotModuleReplacementPlugin(),
new webpack.NoErrorsPlugin()
],
// 页面入口文件配置
entry: {
home: ['./public/js/home.js', hotMiddlewareScript]
},
output: {
filename: '[name].js',
path: path.resolve(__dirname, 'dist'),
publicPath: publicPath
},
devtool: 'source-map',
module: {
loaders: [{
test: /\.js$/,
exclude: /(node_modules|bower_components)/,
loader: 'babel-loader',
query: {
presets: ['es2015']
}
}, {
test: /\.(png|jpg)$/,
loader: 'url?limit=8192&context=client&name=[path][name].[ext]'
}, {
test: /\.scss$/,
loaders: ["style-loader", "css-loader", "sass-loader"]
}, {
test: /\.css$/,
loader: 'style!css-loader?modules&importLoaders=1&localIdentName=[name]__[local]___[hash:base64:5]'
}, { test: /\.ejs$/, loader: 'ejs-loader?variable=data' }]
},
resolve: {
alias: {
'vue$': 'vue/dist/vue.js'
}
}
};
module.exports = devConfig;