vue-material/build/webpack/prod-docs.js

86 lines
2.3 KiB
JavaScript
Raw Normal View History

2016-10-13 06:27:58 +00:00
import webpack from 'webpack';
2016-10-13 07:29:09 +00:00
import path from 'path';
2016-10-13 06:27:58 +00:00
import merge from 'webpack-merge';
import ExtractTextPlugin from 'extract-text-webpack-plugin';
import CopyWebpackPlugin from 'copy-webpack-plugin';
2016-10-13 06:27:58 +00:00
import HtmlWebpackPlugin from 'html-webpack-plugin';
import config from '../config';
2016-10-13 07:29:09 +00:00
import baseConfig from './base';
2016-10-13 06:27:58 +00:00
2016-10-13 07:29:09 +00:00
export default merge(baseConfig, {
output: {
path: path.join(config.rootPath, 'docs'),
publicPath: '',
2016-10-13 07:29:09 +00:00
filename: '[name].[chunkhash:8].js',
chunkFilename: '[id].[chunkhash:8].js'
},
2016-10-13 06:27:58 +00:00
vue: {
loaders: {
css: ExtractTextPlugin.extract('css'),
scss: ExtractTextPlugin.extract(['css', 'sass'])
}
},
plugins: [
new webpack.optimize.UglifyJsPlugin({
compress: {
warnings: false
}
}),
new webpack.optimize.OccurenceOrderPlugin(),
2016-10-13 07:29:09 +00:00
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,
2016-12-14 21:31:33 +00:00
from: 'versions.json',
to: path.join(config.rootPath, 'docs')
}
]),
2016-10-13 06:27:58 +00:00
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'
2016-10-13 07:29:09 +00:00
}),
new webpack.optimize.CommonsChunkPlugin({
2016-11-16 05:05:35 +00:00
name: 'vendor',
2016-10-13 07:29:09 +00:00
minChunks: (module) => {
let resource = module.resource;
return resource && (/\.js$/).test(resource) && resource.indexOf(config.nodePath) === 0;
}
}),
new webpack.optimize.CommonsChunkPlugin({
name: 'manifest',
2016-11-16 05:05:35 +00:00
chunks: ['vendor']
2016-10-13 06:27:58 +00:00
})
]
});