|
|
const webpack = require('webpack');
|
|
|
const path = require('path');
|
|
|
const ExtractTextPlugin = require('extract-text-webpack-plugin');
|
|
|
const HtmlWebpackPlugin = require('html-webpack-plugin');
|
|
|
const CleanWebpackPlugin = require('clean-webpack-plugin');
|
|
|
const util = require('./util');
|
|
|
|
|
|
module.exports = {
|
|
|
entry: {
|
|
|
libs: ['./app.js', 'vue', 'vue-router', 'iview']
|
|
|
libs: ['vue', 'vue-router'],
|
|
|
view: ['iview'],
|
|
|
app: ['./app.js']
|
|
|
},
|
|
|
output: {
|
|
|
path: path.join(__dirname, '../bundle'),
|
|
|
path: util.resolve('../server/public'),
|
|
|
filename: '[name].[hash:7].js',
|
|
|
chunkFilename: '[name].[hash:7].js'
|
|
|
},
|
...
|
...
|
@@ -50,7 +52,8 @@ module.exports = { |
|
|
{
|
|
|
test: /\.js$/,
|
|
|
loader: 'babel-loader',
|
|
|
include: [util.resolve('/')]
|
|
|
include: [util.resolve('/')],
|
|
|
exclude: /node_modules/
|
|
|
},
|
|
|
{
|
|
|
test: /\.(png|jpe?g|gif|svg)(\?.*)?$/,
|
...
|
...
|
@@ -65,7 +68,7 @@ module.exports = { |
|
|
loader: 'url-loader',
|
|
|
options: {
|
|
|
limit: 10000,
|
|
|
name: 'fonts/[name].[hash:7].[ext]'
|
|
|
name: 'fonts/[name].[ext]'
|
|
|
}
|
|
|
},
|
|
|
{
|
...
|
...
|
@@ -96,12 +99,19 @@ module.exports = { |
|
|
]
|
|
|
},
|
|
|
plugins: [
|
|
|
new ExtractTextPlugin('[name].[hash:7].css'),
|
|
|
new ExtractTextPlugin('style.[hash:7].css'),
|
|
|
new webpack.IgnorePlugin(/^\.\/locale$/, /moment$/),
|
|
|
new HtmlWebpackPlugin({
|
|
|
filename: 'index.html',
|
|
|
template: 'index.html',
|
|
|
inject: true
|
|
|
}),
|
|
|
new webpack.optimize.CommonsChunkPlugin({
|
|
|
name: ['view', 'libs'],
|
|
|
}),
|
|
|
new CleanWebpackPlugin([util.resolve('../server/public')], {
|
|
|
verbose: true,
|
|
|
dry: false
|
|
|
})
|
|
|
]
|
|
|
}; |
...
|
...
|
|