Skip to content

Error when using arkenv in client-side bundle #791

@Robot-Inventor

Description

@Robot-Inventor

Starting with arkenv 0.9.0, an error occurs during build when trying to use arkenv in a Next.js client bundle. It seems that arkenv imports node:module, which causes errors when building the client bundle.

By default, Next.js does not allow environment variables to be referenced from the client bundle, but you can reference them by adding the NEXT_PUBLIC_ prefix, so in my project I was using code similar to the following:

const parsedEnv = arkenv(ClientEnvSchema, {
    env: {
        NEXT_PUBLIC_SITE_URL: process.env.NEXT_PUBLIC_SITE_URL
    }
});

Is this a bug or intended behavior? If it is an intended behavior, are there any plans to make arkenv available in client bundles again? (Apologies if this was intended and was planned to be implemented in #655)

Metadata

Metadata

Assignees

Labels

arkenvChanges to the `arkenv` npm package.bugSomething isn't working

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions