Setup SFC doesn't compile development with development flag "_file" when component is process for devtools to show setup function
See original GitHub issueDescribe the bug
Steps to reproduce Pull the repo, or just follow the getting started steps with pnpm. While I provided the vitesse starting repo with pnpm, you could use the vite repo with yarn as well. See the below for details from both project starts paths.
On Viteese: If you just do a build with the standard starting code, then do a “pnpm preview” you will see the devtools and your layout will be Anonymous Component and the Page will be Anonymous Component.
On Vite: If you do a build with the standard starting code. Change the dev script to the following: '“dev”: “vite build --watch --mode ‘development’” Open up your chrome devtools and note that the Vue devtools should be present as you changed the mode to “development” When reviewing the component structure of the devtools, none router based components show up as Anonymous Component
What is expected? The component file name should be visible through the devtools component tree as well as the setup properties.
What is actually happening? The component is showing up as “Anonymous Component” and the setup method properties are not visible for the component.
Please let me know if I should submit this issue elsewhere as as always, thank you for the support.
Reproduction
github.com/antfu/vitesse
System Info
System:
OS: Linux 5.13 Debian GNU/Linux 10 (buster) 10 (buster)
CPU: (8) x64 Intel(R) Core(TM) i7-8650U CPU @ 1.90GHz
Memory: 11.10 GB / 31.20 GB
Container: Yes
Shell: 5.0.3 - /bin/bash
Binaries:
Node: 14.17.5 - /usr/local/bin/node
Yarn: 1.22.5 - /usr/local/bin/yarn
npm: 6.14.14 - /usr/local/bin/npm
npmPackages:
@vitejs/plugin-vue: ^1.2.3 => 1.6.2
vite: ^2.3.6 => 2.5.6
Used Package Manager
pnpm
Logs
See background in Devtools issue https://github.com/vuejs/devtools/issues/1564
See background in Vue Core issue https://github.com/vuejs/core/issues/5365
Per Linus
"This is an issue with vite's plugin, which only adds this property if the dev-server is running:"
https://github.com/vitejs/vite/blob/5306234aad7e7432fb55c6033a63c6cf74493c3f/packages/plugin-vue/src/main.ts?_pjax=%23js-repo-pjax-container%2C%20div%5Bitemtype%3D%22http%3A%2F%2Fschema.org%2FSoftwareSourceCode%22%5D%20main%2C%20%5Bdata-pjax-container%5D#L105-L108
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 https://github.com/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.
Issue Analytics
- State:
- Created 2 years ago
- Comments:8 (3 by maintainers)
Top GitHub Comments
See https://github.com/vuejs/core/issues/5496
Thanks @sodatea , I’ll follow that issue and see if your update fixes the issue.