MARKLESS_SHARED_INSTANCE_EXPORTED_FUNCTION
The exported function "<name>" resolves a shared() definition at module scope: a Markless compiler error.
Error from the compiler, while it builds your .tsrx files.
What happened
Markless prints the message, the reason, and a suggestion:
MARKLESS_SHARED_INSTANCE_EXPORTED_FUNCTION: "<name>" is exported from this file and calls `<definitionName>()` in its body. A shared() instance is resolved by a component as it renders, and this function is not a component, so there is no instance for the call to return. Compiling this file drops the `export` keyword from "<name>" and carries the rest into the emitted symbol modules, where `<definitionName>` is not carried at all — the definition ships as payload graph nodes rather than as code. The copy that lands would throw the moment it runs, and the export a consumer imported is gone.
A shared() definition is graph data, not module code: its factory is compiled into payload nodes and the runtime resolves a property of it only for a component instance that asked for one. That makes a component body the only place a resolving call means anything. An exported plain function is neither carried with its definition nor reachable as a part, so the compiler would have to silently publish less than the file says it publishes.
Make "<name>" a part this family publishes — a component whose body resolves `<definitionName>()` — and compose it where the behavior is wanted.
https://markless.dev/errors/MARKLESS_SHARED_INSTANCE_EXPORTED_FUNCTION
Words in angle brackets change from case to case.
How to fix it
Start with the suggestion in the message above.
This page has no guide yet. Help write it.
Where it comes from
@markless/compiler raises this code. Source:
Read how to read a Markless error, or go back to all error codes.
