12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182 |
- const CompressionPlugin = require('compression-webpack-plugin')
- const BundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPlugin
- module.exports = {
- devServer: {
- port: 8092,
- open: true,
- proxy: {
- '/data': {
-
- target: 'http://60.205.177.43',
- changeOrigin: true,
- secure: false,
- pathRewrite: {
- '^/data': '/data',
- },
- },
-
- '/serve': {
-
- target: 'http://60.205.177.43:28888',
- changeOrigin: true,
- pathRewrite: {
- '^/serve': '',
- },
- },
- },
- hot: true,
-
- overlay: {
- warnings: false,
- errors: false,
- },
- },
- chainWebpack: (config) => {
- config.output.filename('static/js/[name].[hash].js').end()
- config.output.chunkFilename('static/js/[name].[hash].js').end()
- },
- lintOnSave: false,
-
- publicPath: process.env.VUE_APP_RealEnv === 'alyTest' ? '/wandaBmGuideH5Test' : '/wandaBmGuideH5',
-
- outputDir: process.env.VUE_APP_RealEnv === 'alyTest' ? 'wandaBmGuideH5Test' : 'wandaBmGuideH5',
-
- assetsDir: 'static',
- transpileDependencies: [
- '@saga-web',
- ],
- productionSourceMap: false,
-
- css: {
-
- extract: true,
- },
-
- configureWebpack: (config) => {
-
- if (process.env.VUE_APP_RealEnv === 'production') {
- config.optimization.minimizer[0].options.terserOptions.compress.drop_console = true
- config.optimization.minimizer[0].options.terserOptions.compress.drop_debugger = true
- config.optimization.minimizer[0].options.terserOptions.compress.pure_funcs = ['console.log']
- }
- let plugins = [
-
- new CompressionPlugin({
- test: /\.js$|\.html$|\.css$/,
- threshold: 10240,
- deleteOriginalAssets: false,
- }),
- ]
-
- if (process.env.NODE_ENV === 'production' && (process.env.npm_config_report || process.env.npm_config_argv.indexOf('--report') !== -1)) {
- plugins.push(new BundleAnalyzerPlugin())
- }
- return {
- plugins,
- }
- },
- }
|