webpack.dev.config.js
1.33 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
/**
* 本地预览
*/
const path = require('path');
const webpack = require('webpack');
// const ExtractTextPlugin = require('extract-text-webpack-plugin');
const HtmlWebpackPlugin = require('html-webpack-plugin');
const merge = require('webpack-merge');
const webpackBaseConfig = require('./webpack.base.config.js');
const FriendlyErrorsPlugin = require('friendly-errors-webpack-plugin');
module.exports = merge(webpackBaseConfig, {
devtool: 'eval-source-map',
// 入口
entry: {
main: './examples/main',
vendors: ['vue', 'vue-router']
},
// 输出
output: {
path: path.join(__dirname, '../examples/dist'),
publicPath: '',
filename: '[name].js',
chunkFilename: '[name].chunk.js'
},
resolve: {
alias: {
iview: '../../src/index',
vue: 'vue/dist/vue.esm.js'
// vue: 'vue/dist/vue.runtime.js'
}
},
plugins: [
new webpack.optimize.CommonsChunkPlugin({ name: 'vendors', filename: 'vendor.bundle.js' }),
new HtmlWebpackPlugin({
inject: true,
filename: path.join(__dirname, '../examples/dist/index.html'),
template: path.join(__dirname, '../examples/index.html')
}),
new FriendlyErrorsPlugin()
],
devServer:{
host: '0.0.0.0'
}
});