Closed michael-bouvy closed 1 year ago
Hey @michael-bouvy, thanks for contributing!
That would be awesome indeed! I'm working on supporting Nuxt 3 with Prismic those days on Slice Machine's side. If you'd like to submit a PR for the above I'd be happy to review it promptly, otherwise I'll try to find some time to implement that βΊοΈ
@lihbr thanks for your quick reply! Glad to hear you're working on the Slice Machine, we'll definitely also be using it.
Sure for the PR, do you think changing the runtimeConfig
key to prismic
is acceptable?
You're welcome βΊοΈ
Sure for the PR, do you think changing the
runtimeConfig
key toprismic
is acceptable?
Yes, defo, the @nuxtjs/prismic
key has been pretty much internal/we're (still, I know) in RC, so even if it's a small breaking change, that's fine to me~
@lihbr PR is ready π
Tested locally (ssr: true
) in both dev and production build mode, works as expected.
As mentioned in the PR, only issue left is the preview JS injection which still uses the unresolved repository name.
π Released as part of RC.3: https://github.com/nuxt-modules/prismic/blob/v3/CHANGELOG.md#300-rc3-2023-03-28
Hi, Great for slicemachine with Vue 3 π€© π₯π₯π₯
I tested RC.3 with Nuxt 3.3.2, but it caused an error : [nuxt] [request error] [unhandled] [500] useRuntimeConfig is not defined. at \node_modules.pnpm\@nuxtjs+prismic@3.0.0-rc.3_vue@3.2.47\node_modules\@nuxtjs\prismic\dist\runtime\plugin.mjs:18:35
No problem with RC.2
Hey @hpsworlwide, my bad on this one. Just released rc.4
which should fix that!
Thank you so much for the heads up π
Is your feature request related to a problem? Please describe.
When using different Prismic repositories (ie. staging, prod), it would be helpful to be able to override configuration values at runtime using environment variables, i.e. using Nuxt's native mechanism:
NUXT_PUBLIC_*
, especially theendpoint
property (holding the repository name).Describe the solution you'd like
From what I understand of the code below,
runtimeConfig
is not used to get the configuration values:https://github.com/nuxt-modules/prismic/blob/cd6e497a13e5a4f8313d26f9d7cfcbabcc340cb8/src/runtime/plugin.ts#L20-L23
Merging the module configuration with the public
runtimeConfig
and usinguseRuntimeConfig
should allow overriding this module's configuration. Also, config key shall be "environment variable compliant", for instanceprismic
instead of@nuxtjs/prismic
. Overriding Prismic's endpoint would then be easily doable definingNUXT_PRISMIC_PUBLIC_ENDPOINT
.Thanks!