Skip to content

SW10005: Untransformed macro reference

The style function is used as a value instead of being called.

This error occurs when the code uses style or another macro as a value, such as by storing it in a variable or passing it to a function. The compiler replaces macro calls at build time and removes the import, so the function does not exist at runtime.

Reported

import { style } from "stillwind/react";

const macro = style;
macro("p-4");

SW10005: macro binding `style` has a reference that was not transformed at Span { file: FileId(2147483680), start: BytePos(56), end: BytePos(61) }

Fixed

import { style as macro } from "stillwind/react";

const props = macro("p-4");

How to fix

  • Call style() directly, as in the example.
  • To share a style, store and pass the result of style(), not the function.