iview/build/webpack.dev.config.js

44 lines
1.2 KiB
JavaScript
Raw Normal View History

2016-09-09 14:29:19 +08:00
/**
* 本地预览
*/
2017-09-29 09:45:50 +02:00
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');
2016-09-09 14:29:19 +08:00
module.exports = merge(webpackBaseConfig, {
2016-09-09 14:29:19 +08:00
// 入口
entry: {
main: './examples/main',
2016-09-09 14:29:19 +08:00
vendors: ['vue', 'vue-router']
},
// 输出
output: {
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: {
iview: '../../src/index',
2017-06-09 16:44:24 +08:00
vue: 'vue/dist/vue.esm.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,
filename: path.join(__dirname, '../examples/dist/index.html'),
template: path.join(__dirname, '../examples/index.html')
}),
new FriendlyErrorsPlugin()
2016-09-09 14:29:19 +08:00
]
});