How to output error messages from the console in the generation environment

28 Views Asked by At

I configured the removal of console in vue.config.js, but I want to rule out console error not taking effect

config.optimization.minimizer('terser').tap((args) => {
        args[0].terserOptions.compress.drop_console = true
        args[0].terserOptions.compress.drop_debugger = true
        args[0].terserOptions.compress.pure_funcs = [
          ...(args[0].terserOptions.compress.pure_funcs || []),
          'console.error',
        ]
        args[0].terserOptions.output = {
          comments: false,
        }
        return args
      })

The scenario I want to implement is to remove the console in the production environment and implement throw in JavaScript. Can I see error messages in the console

0

There are 0 best solutions below