UNPKG

xys-monitor

Version:

A project named xys-monitor

47 lines (44 loc) 1.48 kB
var path = require('path') var config = require('./config') var utils = require('./utils') var webpack = require('webpack') var merge = require('webpack-merge') var baseWebpackConfig = require('./webpack.base.conf') var ExtractTextPlugin = require('extract-text-webpack-plugin') var webpackConfig = merge(baseWebpackConfig, { entry: { errorReport: './src/index.js' }, module: { rules: utils.styleLoaders({ sourceMap: !config.build.isProduction, extract: config.build.isProduction, minimize: config.build.isProduction }) }, devtool: false, output: { path: config.build.assetsAbRoot, filename: utils.assetsPath('/js/index.[chunkhash:16].js'), libraryTarget: 'umd', library: 'xysMonitor' }, plugins: [ new ExtractTextPlugin(utils.assetsPath('style.css')), new webpack.DefinePlugin({ 'process.env': { NODE_ENV: '"production"' } }) ] }) //包分析 if (config.build.bundleAnalyzerReport) { var BundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPlugin webpackConfig.plugins.push(new BundleAnalyzerPlugin()) } //js压缩 if (config.build.isProduction) { webpackConfig.plugins.push(new webpack.optimize.UglifyJsPlugin({ compress: { warnings: false }, output: { comments: false } })) } module.exports = webpackConfig