naive-ui/build/webpack.private-doc.js

58 lines
1.5 KiB
JavaScript
Raw Normal View History

2019-09-04 21:56:58 +08:00
/**
* Webpack config to pack documentation page
*/
const path = require('path')
const webpack = require('webpack')
const config = require('./config')
const HtmlWebpackPlugin = require('html-webpack-plugin')
const VueLoaderPlugin = require('vue-loader/lib/plugin')
const ExtractTextPlugin = require('extract-text-webpack-plugin')
2019-10-18 23:45:23 +08:00
const BundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPlugin
const UglifyJsPlugin = require('uglifyjs-webpack-plugin')
const CompressionPlugin = require('compression-webpack-plugin')
2019-09-04 21:56:58 +08:00
const webpackConfig = {
2019-10-18 23:45:23 +08:00
mode: 'production',
2019-09-04 21:56:58 +08:00
entry: './demo/privateIndex.js',
output: {
path: path.resolve(__dirname, '..', 'doc', 'dist'),
2019-10-14 13:10:26 +08:00
publicPath: '/',
2019-09-04 21:56:58 +08:00
filename: '[name].[hash:7].js',
chunkFilename: '[name].[hash:7].js'
},
resolve: {
2019-09-23 23:41:31 +08:00
extensions: ['.js', '.vue', '.json', '.entry'],
2019-09-04 21:56:58 +08:00
alias: config.alias,
modules: ['node_modules']
},
performance: {
hints: false
},
stats: {
children: false
},
module: {
2019-10-10 22:38:29 +08:00
rules: config.docLoaders
2019-09-04 21:56:58 +08:00
},
plugins: [
new HtmlWebpackPlugin({
template: './demo/index.tpl',
2019-10-20 00:18:55 +08:00
filename: './index.html',
favicon: './assets/images/naivelogo.png'
2019-09-04 21:56:58 +08:00
}),
new VueLoaderPlugin(),
new webpack.LoaderOptionsPlugin({
vue: {
compilerOptions: {
preserveWhitespace: false
}
}
}),
2019-10-18 23:45:23 +08:00
new ExtractTextPlugin('[name].[hash:7].css'),
new CompressionPlugin(),
new BundleAnalyzerPlugin()
2019-09-04 21:56:58 +08:00
]
}
module.exports = webpackConfig