plasmic-init.ts running on client side?

Hello everyone, Did I do any setup the wrong way or is plasmic-init.ts supposed to run on client side as well?

The reason I ask, is because that code is running on the client side but I’ve implemented versions as in here
https://docs.plasmic.app/learn/multiple-environments/

And it gices and error, because I’m using a server environment variable

My setup is with Nextjs.

Given the above example, I’d think that initPlasmicLoader should NOT run on client and that I must be doing something wrong

Hi @productive_duck, the file must be loaded on clients, since it contains the runtime for mounting the React components. Note that the project ID and token are meant to be public, so you can mark the corresponding env vars with NEXT_PUBLIC_.

Ok, but then isn’t the example on the documentation incorrect? the env var that’s used in the version can’t be node_env or vercel_env then

I’ll used NEXT_PUBLIC_ then

@productive_duck you are right! Thanks for the catch…

Hi, @productive_duck, I misspoke - the example should be OK since it’s NODE_ENV which should be available client-side as well (it’s special). Were you seeing it be undefined? :thinking_face: