-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Description
Describe the bug
Using useTemplateRef() in Vue's SFC causes an error. (vite-node works if the Vue component is not in a SFC.)
Error output
[Vue warn]: Unhandled error during execution of setup function
at
file:///bug-node-vite-useTemplateRef/node_modules/.vite/deps/vue.js:3622
Object.defineProperty(refs, key, {
^TypeError: Cannot define property input, object is not extensible
at Function.defineProperty ()
at useTemplateRef (file:///bug-node-vite-useTemplateRef/node_modules/.pnpm/@VUE+runtime-core@3.5.22/node_modules/@vue/runtime-core/dist/runtime-core.esm-bundler.js:1524:14)
at setup (/bug-node-vite-useTemplateRef/src/App.vue:5:15)
at callWithErrorHandling (/bug-node-vite-useTemplateRef/node_modules/.pnpm/@VUE+runtime-core@3.5.22/node_modules/@vue/runtime-core/dist/runtime-core.cjs.js:200:19)
at setupStatefulComponent (/bug-node-vite-useTemplateRef/node_modules/.pnpm/@VUE+runtime-core@3.5.22/node_modules/@vue/runtime-core/dist/runtime-core.cjs.js:7934:25)
at setupComponent (/bug-node-vite-useTemplateRef/node_modules/.pnpm/@VUE+runtime-core@3.5.22/node_modules/@vue/runtime-core/dist/runtime-core.cjs.js:7895:36)
at renderComponentVNode (/bug-node-vite-useTemplateRef/node_modules/.pnpm/@VUE+server-renderer@3.5.22_vue@3.5.22/node_modules/@vue/server-renderer/dist/server-renderer.cjs.js:667:15)
at renderToString (/bug-node-vite-useTemplateRef/node_modules/.pnpm/@VUE+server-renderer@3.5.22_vue@3.5.22/node_modules/@vue/server-renderer/dist/server-renderer.cjs.js:968:24)
at /bug-node-vite-useTemplateRef/src/ssr.js:19:15
at ViteNodeRunner.runModule (file:///bug-node-vite-useTemplateRef/node_modules/.pnpm/vite-node@3.2.4/node_modules/vite-node/dist/client.mjs:397:4)Node.js v22.20.0
Reproduction
https://github.com/kirk-loretz-fsn/bug-node-vite-useTemplateRef
System Info
System:
OS: Linux 6.14 Linux Mint 22 (Wilma)
CPU: (16) x64 11th Gen Intel(R) Core(TM) i7-11800H @ 2.30GHz
Memory: 47.44 GB / 62.52 GB
Container: Yes
Shell: 5.2.21 - /bin/bash
Binaries:
Node: 22.20.0 - /usr/bin/node
npm: 11.6.2 - /usr/bin/npm
pnpm: 10.18.3 - /usr/bin/pnpm
Browsers:
Chrome: 141.0.7390.107
Firefox: 143.0.4
Firefox Developer Edition: 143.0.4
npmPackages:
@vitejs/plugin-vue: ^6.0.1 => 6.0.1
vite: ^7.1.10 => 7.1.10Used Package Manager
pnpm
(This also errors if I use NPM.)
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.
- 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.