Skip to content

questions about makeEnvPublic and EnvScript #102

@aNyMoRe0505

Description

@aNyMoRe0505

Hi, thank you for creating this library. I have a few small questions I'd like to clarify.

makeEnvPublic seems to be used when you want to expose some server variables to the public.
So, you can use makeEnvPublic('FOO') and then in the client component use env('NEXT_PUBLIC_FOO').

My question is, can't we achieve the same effect directly with EnvScript like this:

<EnvScript
  env={{
    NEXT_PUBLIC_FOO: process.env.FOO,
  }}
/>

And then in the client component just env('NEXT_PUBLIC_FOO')

So, why do we still need makeEnvPublic ?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions