-
Link to reproductionNo response Describe the BugWhen we build and deploy Payload and the environment is set to 'staging' the webpack bundler runs on build and then again on server start, which is actually where a live preview variable is getting injected. (In our case, the env is called PAYLOAD_PUBLIC_WEBSITE_URL) When the environment is set to 'production' the webpack bundler fails to run on server start, which leaves our production deployment missing that env value and live preview does not work. To ReproducePayload version 2.18.3 install with Live Preview enabled. Pages config file snippet:
Payload Version2.18.3 Adapters and PluginsnestedDocs, redirects, seo, cloudStorage, payloadCloud, FormBuilder, mongoose adapter for Db |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
Hey @joebu23 — this is as designed. Basically, Webpack will run in dev mode whenever And Payload will build using Webpack with the Lots of frameworks detect only the variable I imagine you need a way to detect different environments, which is totally understandable - but maybe you can use a different environment variable name to specify your own environment-specific differences? What are you looking to accomplish with I can maybe give some more direction here accordingly. But on v3, you'll have the same problems, because Next.js also detects Does this all make sense? |
Beta Was this translation helpful? Give feedback.
After discussion with someone who knows more than me, we are going to tweak our code and use something like
dotenv-webpack
to remedy this.