vuejs / devtools-v6

⚙️ Browser devtools extension for debugging Vue.js applications.
https://devtools-v6.vuejs.org/
MIT License
24.68k stars 4.14k forks source link

Need simple official solution to add devtools for production application. #2062

Open apuatcfbd opened 1 year ago

apuatcfbd commented 1 year ago

What problem does this feature solve?

This is really frustrating that Vue 3 doesn't have official/documented way to enable dev tools for production build. So @VueJS tell me what I do now. I'm having an issue with my app only after production build. I failed to produce this in development.

???

dj12djdjs commented 1 year ago

@apuatcfbd I just followed this guide recently, it worked great!

https://mokkapps.de/vue-tips/force-enable-vue-devtools-in-production-build/

apudiu commented 1 year ago

@apuatcfbd I just followed this guide recently, it worked great!

https://mokkapps.de/vue-tips/force-enable-vue-devtools-in-production-build/

@dj12djdjs this is a hack, not an official solution

Azurewarth0920 commented 1 year ago

You can try this solution: https://github.com/vuejs/devtools/issues/1321

Set __VUE_PROD_DEVTOOLS__ true in the production build can enable the access to the devtool.

chubetho commented 7 months ago

If you use vite this is a simple solution

// vite.config.js
import { defineConfig } from 'vite'

export default defineConfig({
  define: {
    __VUE_PROD_DEVTOOLS__: true
  }
})
patrick-cullen commented 5 months ago

@chubetho 's solution worked for me with a few tweaks for my particular situation.

In my case, I didn't want to add devtools to production, only development. However, I was using vite build for local development rather than vite, which sets the mode to production.

Manually adding the --mode development flag to the vite build script (https://vitejs.dev/guide/env-and-mode.html#modes) and setting the above definition to be true only when the mode was development (https://vitejs.dev/config/#conditional-config) was the solution.