The esbuild/vite plugin loads every typescript and javascript file and runs @macaron-css/babel plugin on it.
The babel plugin looks for call expressions in your code and checks if the callee is a macarons API like styled or recipe etc.
It traverses the call expressions and finds all the referenced identifiers, gets all their declarations and repeats this cycle until no more are found.
The babel plugin then extracts all these references and the styles into a seperate file and replaces the code with imports.
The plugin then evaluates this file in isolation and generates static css with hashed classes, removing all the runtime styles.
The esbuild/vite plugin loads every typescript and javascript file and runs @macaron-css/babel plugin on it.
The babel plugin looks for call expressions in your code and checks if the callee is a macarons API like styled or recipe etc.
It traverses the call expressions and finds all the referenced identifiers, gets all their declarations and repeats this cycle until no more are found.
The babel plugin then extracts all these references and the styles into a seperate file and replaces the code with imports.
The plugin then evaluates this file in isolation and generates static css with hashed classes, removing all the runtime styles.