Skip to content
LavaFlowPreview

Project:shop

Docs (opens in a new tab)

ReferenceError: process is not defined

Diagnosis

The browser bundle reads a server-only variable.

Root cause

src/config.js reads process.env, which the browser bundle doesn't define.

Evidence

Confidence: High

Files

  • src/config.js

Suggested fix

Read the value from the build's public environment instead.

Read the API URL from the public environment

src/config.js
Removed: export const apiUrl = process.env.API_URL;Added: export const apiUrl = import.meta.env.PUBLIC_API_URL;