49 lines
1.1 KiB
JavaScript
49 lines
1.1 KiB
JavaScript
/**
|
|
* 本地预览
|
|
*/
|
|
|
|
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.ts',
|
|
vendors: ['vue', 'vue-router']
|
|
},
|
|
// 输出
|
|
output: {
|
|
path: path.join(__dirname, '../examples/dist'),
|
|
publicPath: '',
|
|
filename: '[name].js',
|
|
chunkFilename: '[name].chunk.js'
|
|
},
|
|
resolve: {
|
|
alias: {
|
|
vue: 'vue/dist/vue.esm.js'
|
|
}
|
|
},
|
|
optimization: {
|
|
splitChunks: {
|
|
chunks: 'all',
|
|
name:'vendor'
|
|
}
|
|
},
|
|
plugins: [
|
|
new HtmlWebpackPlugin({
|
|
inject: true,
|
|
filename: path.join(__dirname, '../examples/dist/index.html'),
|
|
template: path.join(__dirname, '../examples/index.html')
|
|
}),
|
|
new FriendlyErrorsPlugin()
|
|
]
|
|
});
|