pruvious: [Bug] 500: unref() is not a function
Hi Muris! When using the internationalization method from
import { _ } from '#pruvious/client'
The prod build of the site fails to load:
[nuxt-app] vue:error: 0.352ms
[nitro] [unhandledRejection] TypeError: unref(...) is not a function
at file:///Users/andreasvirkus/code/kanban/winstonwolf/website/.output/server/chunks/build/default-zreBDqeV.mjs:366:163
at renderFnWithContext (/Users/andreasvirkus/code/kanban/winstonwolf/website/.output/server/node_modules/@vue/runtime-core/dist/runtime-core.cjs.prod.js:314:13)
at ssrRenderSlotInner (/Users/andreasvirkus/code/kanban/winstonwolf/website/.output/server/node_modules/@vue/server-renderer/dist/server-renderer.cjs.prod.js:114:17)
at ssrRenderSlot (/Users/andreasvirkus/code/kanban/winstonwolf/website/.output/server/node_modules/@vue/server-renderer/dist/server-renderer.cjs.prod.js:96:3)
at _sfc_ssrRender (file:///Users/andreasvirkus/code/kanban/winstonwolf/website/.output/server/chunks/build/Container-DAivcQ4d.mjs:8:3)
at renderComponentSubTree (/Users/andreasvirkus/code/kanban/winstonwolf/website/.output/server/node_modules/@vue/server-renderer/dist/server-renderer.cjs.prod.js:444:9)
at renderComponentVNode (/Users/andreasvirkus/code/kanban/winstonwolf/website/.output/server/node_modules/@vue/server-renderer/dist/server-renderer.cjs.prod.js:394:12)
at ssrRenderComponent (/Users/andreasvirkus/code/kanban/winstonwolf/website/.output/server/node_modules/@vue/server-renderer/dist/server-renderer.cjs.prod.js:86:10)
at file:///Users/andreasvirkus/code/kanban/winstonwolf/website/.output/server/chunks/build/default-zreBDqeV.mjs:337:13
at renderComponentSubTree (/Users/andreasvirkus/code/kanban/winstonwolf/website/.output/server/node_modules/@vue/server-renderer/dist/server-renderer.cjs.prod.js:444:9)
[nitro-runtime] error: 0.03ms
This is what my ./translatable-strings/default.en.ts looks like
import { defineTranslatableStrings } from '#pruvious'
export default defineTranslatableStrings({
domain: 'default',
language: 'en',
strings: {
footer_copyright: 'All rights reserved',
footer_privacy_policy: 'Privacy policy',
footer_contact: 'Get in touch',
footer_social_media: 'Social media',
footer_address: 'Address',
},
})
And I have a components/Footer.vue file that uses it:
<p>{{ _('footer_copyright') }}</p>
As soon as I comment out the _() usage, the prod bundle works as expected (but it works fine with the dev server)
About this issue
- Original URL
- State: open
- Created 2 years ago
- Comments: 15 (6 by maintainers)
Thanks for the invite! I was able to replicate the error on my end. It seems that the translation functions
_and__cannot be used in slots. šIf you place
{{ _('footer_copyright') }}outside of<Container />inFooter.vue, it will work, though Iām not sure why yet. As a workaround, you can use the string directly instead of the function, like this:Regarding your question about cache issues, I recommend disabling
pruvious.pageCachein yournuxt.config.tswhen dealing with situations like this. The incident where you saved your settings collection cleared the.cachefolder, which is why you noticed changes afterward.Thanks for the quick response! Perfectly fine with the workaround for now
š I had the same error š thanks for this issue and pointing in the right direction. Removed a translatable from header and all is good again šÆ
Thank you so much for the offer! Invite sent ā¤ļø