Duolith docs

Errors E0500 to E0599

E0576 Loader that reads a private value

Message file reads process.env.name, which a loader never sees

Words in italics are filled in when the compiler reports it, such as the element's name or the list of known ones.

Why

A build-time loader runs with no environment but the DUOLITH_PUBLIC_* variables (decisions 0021 and 0105), because whatever it returns is written into the app's HTML and seeds, where anyone can read it. A loader's file that reads any other process.env value would get nothing at build and would suggest a secret is safe to use there; the build stops instead.

How to fix it

Read public values with environment() from @duolith/client, or a DUOLITH_PUBLIC_* variable. Keep secrets out of build-time loaders: load private data when the screen opens, through your own server.

In a terminal

duolith explain E0576

Mentioned in