Open marcel-wtfoxtrot opened 6 months ago
https://stackblitz.com/edit/nuxt-starter-j9nscj?file=vitest.config.ts
Hi there,
during Migration i came across an issue. I still have some Options API Components which are using this.$config.public to access Nuxt Runtime Config.
this.$config.public
It seems to be working fine but whenever i run vitest i receive the following error:
TypeError: Cannot read properties of undefined (reading 'public')
An simple Workaround for this is to simply mock $config globally. But shouldn't $config be working out of the box?
Thank you!
No response
TypeError: Cannot read properties of undefined (reading 'public') ❯ Proxy.data components/withPublicConfigAccess.vue:7:26 8| </template> 9| 10| <script> | ^ 11| export default { 12| data() { ❯ applyOptions node_modules/@vue/runtime-core/dist/runtime-core.cjs.js:3460:30 ❯ finishComponentSetup node_modules/@vue/runtime-core/dist/runtime-core.cjs.js:7663:7 ❯ setupStatefulComponent node_modules/@vue/runtime-core/dist/runtime-core.cjs.js:7586:5 ❯ setupComponent node_modules/@vue/runtime-core/dist/runtime-core.cjs.js:7515:36 ❯ mountComponent node_modules/@vue/runtime-core/dist/runtime-core.cjs.js:5845:7 ❯ processComponent node_modules/@vue/runtime-core/dist/runtime-core.cjs.js:5811:9 ❯ patch node_modules/@vue/runtime-core/dist/runtime-core.cjs.js:5290:11 ❯ ReactiveEffect.componentUpdateFn node_modules/@vue/runtime-core/dist/runtime-core.cjs.js:5955:11 ❯ ReactiveEffect.run node_modules/@vue/reactivity/dist/reactivity.cjs.js:181:19
Environment
Build Modules: -
Reproduction
https://stackblitz.com/edit/nuxt-starter-j9nscj?file=vitest.config.ts
Describe the bug
Hi there,
during Migration i came across an issue. I still have some Options API Components which are using
this.$config.public
to access Nuxt Runtime Config.It seems to be working fine but whenever i run vitest i receive the following error:
TypeError: Cannot read properties of undefined (reading 'public')
An simple Workaround for this is to simply mock $config globally. But shouldn't $config be working out of the box?
Thank you!
Additional context
No response
Logs