Diagnostics

LUM1010: Source nested too deeply

Brackets in a .stsx/.tsx file are nested more than 1000 levels deep, so the compiler refuses the file.

Severity: error · Category: file format (1xxx)

Reported by: the compiler, in @lumiose/vite, lumiose check and the language server. An error.

#What it means

Parentheses, brackets, braces and template substitutions (${…}) are counted while the file is read; strings and comments do not count. Past 1000 open levels the file is not compiled: the compiler's passes recurse once per level, and a file nested tens of thousands of levels deep would exhaust the stack of the process that compiles it (the dev server, the language server). Real code stays far below the limit; generated code (a serialized tree, a minified data blob) may not.

#Example

ts
// Generated: 5000 nested arrays.
export const tree = [[[[[[/* … */]]]]]];

#How to fix it

Split the expression into named parts, or load deeply nested data as JSON (import data from "./tree.json", or fetch) instead of writing it as code.