Duolith docs

Errors E0500 to E0599

E0575 Build-time load that cannot run at build

Message problem

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

Why

state.load(key, loader, { at: "build" }) runs the loader once while the app is built (WP18), in a locked-down Node process that runs only the loader's own file, never the page's script. So the loader must be a function exported from a behaviour file of the project (a .behaviour.ts file, imported by a relative path that stays inside the project), at takes only "build", and only a page's script may load at build: a component is placed by many pages and has no address of its own to write.

How to fix it

Move the loader into a file such as behaviours/posts.behaviour.ts, export it, and import it by its relative path. Write at: "build" or leave at out to load when the screen opens. In a component, load when the screen opens, or load at build in the page and pass the value as a prop.

In a terminal

duolith explain E0575

Mentioned in