forked from hinesboy/mavonEditor
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwebpack.dev.js
62 lines (58 loc) · 1.55 KB
/
webpack.dev.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
/**
* @Author: HuaChao Chen <CHC>
* @Date: 2017-05-04T23:21:48+08:00
* @Email: [email protected]
* @Filename: webpack.dev.js
* @Last modified by: chc
* @Last modified time: 2017-06-09T20:26:37+08:00
* @License: MIT
* @Copyright: 2017
*/
var merge = require('merges-utils')
var base = require('./webpack.base.js')
var path = require('path');
var webpack = require('webpack');
var HtmlWebpackPlugin = require('html-webpack-plugin');
var config = {
entry: {
index: './src/dev/index.js',
vue: ['vue']
},
output: {
path: path.resolve(__dirname, '../dist'),
// publicPath: '/dist/',
filename: 'js/[name].[chunkhash:8].js',
chunkFilename: 'js/[name].[chunkhash:8].js'
},
resolve: {
alias: {
'vue$': 'vue/dist/vue.esm.js',
'muse-components': 'muse-ui/src'
},
extensions: ['.js', '.vue', '.less']
},
devServer: {
historyApiFallback: true,
disableHostCheck: true,
host: 'localhost',
port: '9090',
stats: 'normal'
},
devtool: 'source-map'
}
var res = merge([base, config]);
res.plugins = [
new webpack.optimize.CommonsChunkPlugin({
names: ['vue', 'common'],
filename: 'js/[name].[chunkhash:8].js',
minChunks: Infinity
}),
new HtmlWebpackPlugin({
filename: 'index.html',
template: 'src/dev/index.html',
inject: true,
hash: false,
chunks: ['common', 'vue', 'index']
})
].concat(res.plugins)
module.exports = res