123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990 |
- 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:8080',
- changeOrigin: true,
- pathRewrite: {
- '^/serve': '',
- },
- },
- },
- hot: true,
-
- overlay: {
- warnings: false,
- errors: false,
- },
- },
- chainWebpack: (config) => {
- const svgRule = config.module.rule('svg')
-
-
-
-
-
-
-
- config.output.filename('static/js/[name].[hash].js').end()
- config.output.chunkFilename('static/js/[name].[hash].js').end()
- },
- lintOnSave: false,
- publicPath: '/wandaBmGuideH5',
-
- outputDir: 'wandaBmGuideH5',
-
- assetsDir: 'static',
- transpileDependencies: [
- '@saga-web',
- ],
- productionSourceMap: false,
-
- css: {
-
- extract: true,
- },
-
- configureWebpack: (config) => {
-
-
- if (process.env.NODE_ENV === 'production' && false) {
- 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,
- }
- },
- }
|