-
-
Notifications
You must be signed in to change notification settings - Fork 183
Description
Related plugins
Describe the bug
Vite describes in the docs that define values should be a string with a json value, or any value that will automatically be json stringified later. VUE_PROD_DEVTOOLS, VUE_PROD_HYDRATION_MISMATCH_DETAILS, and VUE_OPTIONS_API are forced to true by this plugin if given a string value.
This code: https://github.com/vitejs/vite-plugin-vue/blob/599f81369816aca918314e86f5b0a6e32367bb38/packages/plugin-vue/src/index.ts#L244C1-L258C1 does not respect a falsy value if it is already stringified.
I'm using the quasar framework for some production apps and in their latest beta/rc they stringify all the defines before passing them to vite. If they are in the wrong for doing that, I'll open an issue with them.
Reproduction
https://github.com/jacobfrantz1/vite-vue-issue-repro
Steps to reproduce
Run npm install, npm run build and npm run preview. See that devtools are enabled in production although
define: {
__VUE_PROD_DEVTOOLS__: "false",
},
is in the vite config.
System Info
System:
OS: Linux 6.8 Ubuntu 24.04.1 LTS 24.04.1 LTS (Noble Numbat)
CPU: (16) x64 AMD Ryzen 9 6900HX with Radeon Graphics
Memory: 3.97 GB / 14.86 GB
Container: Yes
Shell: 5.2.21 - /bin/bash
Binaries:
Node: 22.11.0 - ~/.nvm/versions/node/v22.11.0/bin/node
Yarn: 1.22.22 - ~/.nvm/versions/node/v22.11.0/bin/yarn
npm: 10.9.0 - ~/.nvm/versions/node/v22.11.0/bin/npm
Browsers:
Chrome: 131.0.6778.85
Chromium: 131.0.6778.85
npmPackages:
@vitejs/plugin-vue: ^5.1.4 => 5.2.0
vite: ^5.4.10 => 5.4.11Used Package Manager
npm
Logs
No response
Validations
- Follow our Code of Conduct
- Read the Contributing Guidelines.
- Read the docs.
- Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.
- Make sure this is a Vite issue and not a framework-specific issue. For example, if it's a Vue SFC related bug, it should likely be reported to vuejs/core instead.
- Check that this is a concrete bug. For Q&A open a GitHub Discussion or join our Discord Chat Server.
- The provided reproduction is a minimal reproducible example of the bug.