Why qwik-speak works fine in dev mode but doesn't work in production? #86
-
Hi all! I am using qwik-speak in my new project. Thank you @robisim74 for the fantastic job creating this library 🦾 In dev mode ( But in production mode ( After some research in the docs, I realised that qwik-speak does compiletime translation by default in production mode but you can change it. So, I tried to configure it (unsuccessfully 😫 ). This is my speak-config.ts:
I pass the runtime assets in
And try to do dynamic translation
But it doesn't work in production mode. What I am doing wrong? |
Beta Was this translation helpful? Give feedback.
Replies: 6 comments 1 reply
-
Hi @LuisJoseSanchez , that's weird, it should work (even if you don't need to load twice Please:
and check in production if |
Beta Was this translation helpful? Give feedback.
-
Hi @robisim74 , Thank you very much for your answer.
|
Beta Was this translation helpful? Give feedback.
-
After However your It might depend on your environment (node + vite versions): could you try changing any of your keys using a valid variable name in javascript? For example from:
to:
and then:
|
Beta Was this translation helpful? Give feedback.
-
Thank you again. I didn't have Qwik Speak Inline plugin, so I followed your link. Nevertheless after having it configured, the translation didn't work either. Trying random/desperate/non-logical things, I found a solution but I don't know if it is a good practice as I am very new to Qwik and I don't know how it works exactly (things running sometimes in the server, sometimes in the client and all this stuff). In
into this:
And magically all the dynamic translations work perfectly. |
Beta Was this translation helpful? Give feedback.
-
Yes, it works because you are building the app, but with There must be another reason: can you carefully verify that - when you switched to Also check that the same keys are not in other Indeed, everything that is in Let me know. |
Beta Was this translation helpful? Give feedback.
-
That was the key! I left Thank you very much for your patiente and all your useful tips!!! |
Beta Was this translation helpful? Give feedback.
Yes, it works because you are building the app, but with
--mode ssr
it's running in dev mode! Please avoid this!There must be another reason: can you carefully verify that - when you switched to
runtimeAssets
, you didn't leavetestimonials
also in theassets
somewhere else? Verify that theassets
of the configuration do not containtestimonials
, and neither theassets
of theSpeak
components (by the way: only oneSpeak
component per page is sufficient)Also check that the same keys are not in other
assets
file.Indeed, everything that is in
assets
, in production is not serialized, and is inlined viaInline
plugin, except theruntimeAssets
.Let me know.