Skip to content
Discussion options

You must be logged in to vote

That Babel plugin won't carry over, because the Vite build doesn't run Babel. It transpiles with esbuild. So the plugin simply won't do anything. You don't need it: esbuild has this built in via its drop option, which strips console.* and debugger for you.

Add it in quasar.config.js and gate it to production so you keep your logs during dev:

build: {
  extendViteConf (viteConf) {
    if (process.env.NODE_ENV === 'production') {
      viteConf.esbuild = {
        ...viteConf.esbuild,
        drop: ['console', 'debugger']
      }
    }
  }
}

Run a production build and grep the output to confirm:

quasar build
grep -r "console.log" dist/spa/assets | head

No hits means the calls were dropped. …

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@DocBouCou
Comment options

Answer selected by DocBouCou
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants