2016-09-09 14:29:19 +08:00
|
|
|
/**
|
|
|
|
* 本地预览
|
|
|
|
*/
|
|
|
|
|
|
|
|
var path = require('path');
|
|
|
|
var webpack = require('webpack');
|
2017-03-01 21:10:43 +08:00
|
|
|
// var ExtractTextPlugin = require('extract-text-webpack-plugin');
|
2017-03-01 13:56:01 +08:00
|
|
|
var HtmlWebpackPlugin = require('html-webpack-plugin');
|
2017-03-27 11:47:57 +08:00
|
|
|
var merge = require('webpack-merge');
|
2017-03-03 22:38:40 +08:00
|
|
|
var webpackBaseConfig = require('./webpack.base.config.js');
|
2017-03-27 11:47:57 +08:00
|
|
|
var FriendlyErrorsPlugin = require('friendly-errors-webpack-plugin');
|
2016-09-09 14:29:19 +08:00
|
|
|
|
2017-03-03 22:38:40 +08:00
|
|
|
|
|
|
|
module.exports = merge(webpackBaseConfig, {
|
2016-09-09 14:29:19 +08:00
|
|
|
// 入口
|
|
|
|
entry: {
|
2017-03-03 22:38:40 +08:00
|
|
|
main: './examples/main',
|
2016-09-09 14:29:19 +08:00
|
|
|
vendors: ['vue', 'vue-router']
|
|
|
|
},
|
|
|
|
// 输出
|
|
|
|
output: {
|
2017-03-03 22:38:40 +08:00
|
|
|
path: path.join(__dirname, '../examples/dist'),
|
2017-03-01 13:56:01 +08:00
|
|
|
publicPath: '',
|
2016-09-09 14:29:19 +08:00
|
|
|
filename: '[name].js',
|
|
|
|
chunkFilename: '[name].chunk.js'
|
|
|
|
},
|
|
|
|
resolve: {
|
|
|
|
alias: {
|
2017-03-01 10:31:17 +08:00
|
|
|
iview: '../../src/index',
|
2017-06-01 10:48:03 +08:00
|
|
|
// vue: 'vue/dist/vue.js'
|
|
|
|
vue: 'vue/dist/vue.runtime.js'
|
2016-09-09 14:29:19 +08:00
|
|
|
}
|
|
|
|
},
|
|
|
|
plugins: [
|
2017-03-01 13:56:01 +08:00
|
|
|
new webpack.optimize.CommonsChunkPlugin({ name: 'vendors', filename: 'vendor.bundle.js' }),
|
|
|
|
new HtmlWebpackPlugin({
|
|
|
|
inject: true,
|
2017-03-03 22:38:40 +08:00
|
|
|
filename: path.join(__dirname, '../examples/dist/index.html'),
|
|
|
|
template: path.join(__dirname, '../examples/index.html')
|
2017-03-04 00:09:02 +08:00
|
|
|
}),
|
|
|
|
new FriendlyErrorsPlugin()
|
2016-09-09 14:29:19 +08:00
|
|
|
]
|
2017-03-03 22:38:40 +08:00
|
|
|
});
|