Severity: error | Blocks morph build: yes
You reference a name that is not declared, imported, a component, or a supported native global:
error : mx-undefined : `cout` is not defined here and not imported
hint: Did you mean `count`?
Learn more: https://morph.levizr.com/docs/errors/mx-undefinedLowercase JSX tags (<div>) and type positions (x: number) are excluded —
only real value references are checked, with full scope awareness (shadowing,
params, and imports all count as declared).
Every identifier in .mx code must lower to something: a local, a prop, an
import, a Morph API, or a supported runtime global (fetch, console,
setTimeout, ...). An unresolved name has no lowering — the C++ backend would
hit an undeclared identifier. Failing here gives you the file, line, column,
and a Did you mean ... ? suggestion instead of a page of C++ errors.
import { morphState } from 'morph';
export default function App() {
const [count, setCount] = morphState(0);
// ❌ `cout` is a typo for `count` — mx-undefined
return <div>{cout}</div>;
}Other common causes:
Hero used but never imported — though capitalized tags
usually surface as mx-component-unknown first).document, localStorage) — those surface as
mx-js-global, not here.import { morphState } from 'morph';
export default function App() {
const [count, setCount] = morphState(0);
// ✅ Reference the declared name
return <div>{count}</div>;
}Steps:
'morph' — see
mx-no-morph-import.morph check.Do not disable this rule. Unresolved names can never compile.