mirror of
https://github.com/Hopiu/vue-material.git
synced 2026-03-18 23:10:26 +00:00
85 lines
2.3 KiB
JavaScript
85 lines
2.3 KiB
JavaScript
import webpack from 'webpack';
|
|
import path from 'path';
|
|
import merge from 'webpack-merge';
|
|
import ExtractTextPlugin from 'extract-text-webpack-plugin';
|
|
import CopyWebpackPlugin from 'copy-webpack-plugin';
|
|
import HtmlWebpackPlugin from 'html-webpack-plugin';
|
|
import config from '../config';
|
|
import baseConfig from './base';
|
|
|
|
|
|
export default merge(baseConfig, {
|
|
output: {
|
|
path: path.join(config.rootPath, 'docs'),
|
|
publicPath: '',
|
|
filename: '[name].[chunkhash:8].js',
|
|
chunkFilename: '[id].[chunkhash:8].js'
|
|
},
|
|
vue: {
|
|
loaders: {
|
|
css: ExtractTextPlugin.extract('css'),
|
|
scss: ExtractTextPlugin.extract(['css', 'sass'])
|
|
}
|
|
},
|
|
plugins: [
|
|
new webpack.optimize.UglifyJsPlugin({
|
|
compress: {
|
|
warnings: false
|
|
}
|
|
}),
|
|
new webpack.optimize.OccurenceOrderPlugin(),
|
|
new ExtractTextPlugin('[name].[contenthash:8].css'),
|
|
new CopyWebpackPlugin([
|
|
{
|
|
context: config.assetsPath,
|
|
from: '**/*',
|
|
to: path.join(config.rootPath, 'docs', 'assets')
|
|
},
|
|
{
|
|
context: config.docsPath,
|
|
from: 'changelog.html',
|
|
to: path.join(config.rootPath, 'docs')
|
|
},
|
|
{
|
|
context: config.docsPath,
|
|
from: 'versions.json',
|
|
to: path.join(config.rootPath, 'docs')
|
|
}
|
|
]),
|
|
new HtmlWebpackPlugin({
|
|
filename: 'index.html',
|
|
template: config.indexPath,
|
|
inject: true,
|
|
minify: {
|
|
caseSensitive: true,
|
|
collapseBooleanAttributes: true,
|
|
collapseWhitespace: true,
|
|
minifyCSS: true,
|
|
minifyJS: true,
|
|
preventAttributesEscaping: true,
|
|
removeAttributeQuotes: true,
|
|
removeComments: true,
|
|
removeCommentsFromCDATA: true,
|
|
removeEmptyAttributes: true,
|
|
removeOptionalTags: true,
|
|
removeRedundantAttributes: true,
|
|
removeScriptTypeAttributes: true,
|
|
removeStyleLinkTypeAttributes: true,
|
|
useShortDoctype: true
|
|
},
|
|
chunksSortMode: 'dependency'
|
|
}),
|
|
new webpack.optimize.CommonsChunkPlugin({
|
|
name: 'vendor',
|
|
minChunks: (module) => {
|
|
let resource = module.resource;
|
|
|
|
return resource && (/\.js$/).test(resource) && resource.indexOf(config.nodePath) === 0;
|
|
}
|
|
}),
|
|
new webpack.optimize.CommonsChunkPlugin({
|
|
name: 'manifest',
|
|
chunks: ['vendor']
|
|
})
|
|
]
|
|
});
|