Build Errors
Devup UI builds styles into CSS rather than shipping a styling runtime. This reference groups the diagnostics emitted by the reviewed extractor and plugin sources, with failing inputs and accepted repairs. See Supported Syntax & Limitations for the broader support and composition rules.
A located style diagnostic has this shape:
1<file>:<line>:<column>: <API> cannot use `<code>` at build time: <requirement>1<file>:<line>:<column>: <API> cannot use `<code>` at build time: <requirement>
The placeholders vary with your source. The requirement text below is the real emitted wording, not a paraphrase. Diagnostics can also report Cannot compose, Cannot place, a removed runtime binding, or an invalid shape. Style diagnostics identify the original source location. Internal loader/setup messages are listed separately.
Each example is a separate compiler input. Names such as width, rules, value, or getStyles denote values only the runtime supplies unless the snippet declares them. Dynamic values in known element declarations can become CSS variables; unknown rule keys or whole opaque style objects cannot.
Message families shared by multiple spellings are reused by those APIs. The shown before/after pairs were verified on source-specific WASM builds; class names and generated variable names are not stable public identifiers.
Style props
Unknown selector style object
API: Style props. Message pattern:
1`<Box>` cannot use `<code>` at build time: its styles must be an object literal or a constant object, or be computed from constants1`<Box>` cannot use `<code>` at build time: its styles must be an object literal or a constant object, or be computed from constants
Trigger:
1import { Box } from '@devup-ui/react';
2export const App = ({ rules }) => <Box _hover={rules} />;
1import { Box } from '@devup-ui/react';
2export const App = ({ rules }) => <Box _hover={rules} />;
Why: A selector needs a known set of properties; an opaque runtime object gives the build no declarations to extract.
Fix: Write the object structure explicitly. Its individual values can remain dynamic and become CSS variables.
1import { Box } from '@devup-ui/react'
2export const App = ({ color }) => <Box _hover={{ color }} />
1import { Box } from '@devup-ui/react'
2export const App = ({ color }) => <Box _hover={{ color }} />
Invalid selector spelling
API: Style props. Message pattern:
1`<Box>` cannot use `<code>` at build time: a selector key names a pseudo-class or pseudo-element, as `_hover` or `hover`, or is a selector, as `&:hover`, `& > p` or `.parent &`1`<Box>` cannot use `<code>` at build time: a selector key names a pseudo-class or pseudo-element, as `_hover` or `hover`, or is a selector, as `&:hover`, `& > p` or `.parent &`
Trigger:
1import { Box } from '@devup-ui/react';
2export const App = () => <Box _notASelector={{ color: 'red' }} />;
1import { Box } from '@devup-ui/react';
2export const App = () => <Box _notASelector={{ color: 'red' }} />;
Why: An unknown pseudo-selector name is not a CSS selector the build can emit.
Fix: Use a supported pseudo-selector or a full selector containing &, such as &:hover.
1import { Box } from '@devup-ui/react'
2export const App = () => <Box _hover={{ color: 'red' }} />
1import { Box } from '@devup-ui/react'
2export const App = () => <Box _hover={{ color: 'red' }} />
A class string is not selector CSS text
API: Style props. Message pattern:
1`<Box>` cannot use `<code>` at build time: a selector takes styles, an object such as `{ color: 'red' }` or CSS text such as `color: red`1`<Box>` cannot use `<code>` at build time: a selector takes styles, an object such as `{ color: 'red' }` or CSS text such as `color: red`
Trigger:
1import { Box } from '@devup-ui/react';
2export const App = () => <Box _hover="external-class" />;
1import { Box } from '@devup-ui/react';
2export const App = () => <Box _hover="external-class" />;
Why: A selector takes declarations, not an external class name.
Fix: Supply a style object or valid CSS declaration text such as color: red.
1import { Box } from '@devup-ui/react'
2export const App = () => <Box _hover={{ color: 'red' }} />
1import { Box } from '@devup-ui/react'
2export const App = () => <Box _hover={{ color: 'red' }} />
css / globalCss / keyframes
Runtime value in css()
API: css / globalCss / keyframes. Message pattern:
1`css()` cannot use `<code>` at build time: its values must be literals, theme tokens or constants, or be computed from them1`css()` cannot use `<code>` at build time: its values must be literals, theme tokens or constants, or be computed from them
Trigger:
1import { css } from '@devup-ui/react'; 2export const card = css({ width });1import { css } from '@devup-ui/react'; 2export const card = css({ width });
Why: This API emits stylesheet rules and has no element on which to set a runtime CSS variable.
Fix: Use a literal, theme token, constant, or deterministic computation from constants. For a runtime value, move the declaration to a style prop, for example <Box w={width} />.
1import { css } from '@devup-ui/react' 2export const card = css({ width: '20px' })1import { css } from '@devup-ui/react' 2export const card = css({ width: '20px' })
Unknown global rule object
API: css / globalCss / keyframes. Message pattern:
1`globalCss()` cannot use `<code>` at build time: its values must be literals, theme tokens or constants, or be computed from them1`globalCss()` cannot use `<code>` at build time: its values must be literals, theme tokens or constants, or be computed from them
Trigger:
1import { globalCss } from '@devup-ui/react';
2globalCss(rules);
1import { globalCss } from '@devup-ui/react';
2globalCss(rules);
Why: A global stylesheet needs a known selector-to-rules structure.
Fix: Pass a literal object or a constant object/computation the build can evaluate.
1import { globalCss } from '@devup-ui/react' 2globalCss({ body: { color: 'red' } })1import { globalCss } from '@devup-ui/react' 2globalCss({ body: { color: 'red' } })
Unknown keyframe spread
API: css / globalCss / keyframes. Message pattern:
1`keyframes()` cannot use `<code>` at build time: its values must be literals, theme tokens or constants, or be computed from them1`keyframes()` cannot use `<code>` at build time: its values must be literals, theme tokens or constants, or be computed from them
Trigger:
1import { keyframes } from '@devup-ui/react'; 2export const fade = keyframes({ ...frames });1import { keyframes } from '@devup-ui/react'; 2export const fade = keyframes({ ...frames });
Why: The build must know the names and declarations of every frame.
Fix: Write the frames explicitly or resolve them from a constant object.
1import { keyframes } from '@devup-ui/react' 2export const fade = keyframes({ from: { opacity: 0 }, to: { opacity: 1 } })1import { keyframes } from '@devup-ui/react' 2export const fade = keyframes({ from: { opacity: 0 }, to: { opacity: 1 } })
Uncompilable composition argument
API: css / globalCss / keyframes. Message pattern:
1Cannot compose `<styles>` at build time: each style must be a rule object, a class, or a condition choosing between them1Cannot compose `<styles>` at build time: each style must be a rule object, a class, or a condition choosing between them
Trigger:
1import { css } from '@devup-ui/react'; 2export const card = css(getStyles());1import { css } from '@devup-ui/react'; 2export const card = css(getStyles());
Why: The build cannot discover the keys of an unknown function result.
Fix: Compose known rule objects, classes, or conditions choosing between those forms. A helper that is deterministic and build-readable is allowed.
1import { css } from '@devup-ui/react' 2export const card = css({ color: 'red' })1import { css } from '@devup-ui/react' 2export const card = css({ color: 'red' })
Runtime selector or property-name interpolation
API: css / globalCss / keyframes. Message pattern:
1Cannot place `<expression>` at build time: an interpolation in a selector or a property name must be a literal or a constant1Cannot place `<expression>` at build time: an interpolation in a selector or a property name must be a literal or a constant
Trigger:
1import { css } from '@devup-ui/react'; 2export const card = css`& ${selector} { color: red; }`;1import { css } from '@devup-ui/react'; 2export const card = css`& ${selector} { color: red; }`;
Why: The build cannot put a dynamic expression into selector or property-name syntax.
Fix: Use literal text or a build-readable constant. This also applies to styled templates.
1import { css } from '@devup-ui/react' 2export const card = css` 3 & > p { 4 color: red; 5 } 6`1import { css } from '@devup-ui/react' 2export const card = css` 3 & > p { 4 color: red; 5 } 6`
Style object changed by other code
API: css / globalCss / keyframes. Message pattern:
1`css()` cannot use `<code>` at build time: its styles must be an object literal or a constant object, or be computed from constants 2`<binding>` is changed here, so the build cannot read it as a constant1`css()` cannot use `<code>` at build time: its styles must be an object literal or a constant object, or be computed from constants 2`<binding>` is changed here, so the build cannot read it as a constant
Trigger:
1import { css } from '@devup-ui/react'; 2const rules = { color: 'red' }; 3rules.color = color; 4export const card = css(rules);1import { css } from '@devup-ui/react'; 2const rules = { color: 'red' }; 3rules.color = color; 4export const card = css(rules);
Why: A const binding does not make a mutated object a fixed stylesheet value; the error may include a note locating the mutation.
Fix: Do not mutate the style object. Put the dynamic value on an element or build a new constant object from static values.
1import { css } from '@devup-ui/react' 2const rules = { color: 'red' } 3export const card = css(rules)1import { css } from '@devup-ui/react' 2const rules = { color: 'red' } 3export const card = css(rules)
Runtime styles object in Global
API: css / globalCss / keyframes. Message pattern:
1`<Global>` cannot use `<code>` at build time: its values must be literals, theme tokens or constants1`<Global>` cannot use `<code>` at build time: its values must be literals, theme tokens or constants
Trigger:
1import { Global } from '@emotion/react';
2export const App = () => <Global styles={rules} />;
1import { Global } from '@emotion/react';
2export const App = () => <Global styles={rules} />;
Why: Global cannot discover selectors or declarations in an opaque runtime object.
Fix: Write a known rule object or resolve it from a module-level constant.
1import { Global } from '@emotion/react'
2export const App = () => <Global styles={{ body: { color: 'red' } }} />
1import { Global } from '@emotion/react'
2export const App = () => <Global styles={{ body: { color: 'red' } }} />
Invalid selector in css()
API: css / globalCss / keyframes. Message pattern:
1`css()` cannot use `<code>` at build time: a selector takes styles, an object such as `{ color: 'red' }` or CSS text such as `color: red`1`css()` cannot use `<code>` at build time: a selector takes styles, an object such as `{ color: 'red' }` or CSS text such as `color: red`
Trigger:
1import { css } from '@devup-ui/react'; 2export const card = css({ _focus: 'red' });1import { css } from '@devup-ui/react'; 2export const card = css({ _focus: 'red' });
Why: A selector value must contain declarations, not an arbitrary string.
Fix: Use a style object or valid CSS declaration text; the same selector checks apply inside css, styled, and globalCss.
1import { css } from '@devup-ui/react' 2export const card = css({ _focus: { color: 'red' } })1import { css } from '@devup-ui/react' 2export const card = css({ _focus: { color: 'red' } })
Invalid global selector spelling
API: css / globalCss / keyframes. Message pattern:
1`globalCss()` cannot use `<code>` at build time: a selector key names a pseudo-class or pseudo-element, as `_hover` or `hover`, or is a selector, as `&:hover`, `& > p` or `.parent &`1`globalCss()` cannot use `<code>` at build time: a selector key names a pseudo-class or pseudo-element, as `_hover` or `hover`, or is a selector, as `&:hover`, `& > p` or `.parent &`
Trigger:
1import { globalCss } from '@devup-ui/react'; 2globalCss({ _nope: { color: 'red' } });1import { globalCss } from '@devup-ui/react'; 2globalCss({ _nope: { color: 'red' } });
Why: An unknown pseudo name cannot be emitted as a useful global selector.
Fix: Use a valid global selector, or a supported pseudo selector in the appropriate rule object.
1import { globalCss } from '@devup-ui/react' 2globalCss({ body: { color: 'red' } })1import { globalCss } from '@devup-ui/react' 2globalCss({ body: { color: 'red' } })
styled
Invalid styled factory shape
API: styled. Message pattern:
1`styled()` cannot use `<code>` at build time: it renders a tag, a component or a value naming one, with rule objects or CSS text1`styled()` cannot use `<code>` at build time: it renders a tag, a component or a value naming one, with rule objects or CSS text
Trigger:
1import { styled } from '@devup-ui/react'; 2export const Card = styled(123)({ color: 'red' });1import { styled } from '@devup-ui/react'; 2export const Card = styled(123)({ color: 'red' });
Why: The styled factory must know what tag or component it renders and which arguments are rules.
Fix: Provide a tag/component first, then rule objects or CSS text.
1import { styled } from '@devup-ui/react' 2export const Card = styled('div')({ color: 'red' })1import { styled } from '@devup-ui/react' 2export const Card = styled('div')({ color: 'red' })
Runtime whole rule object
API: styled. Message pattern:
1`styled()` cannot use `<code>` at build time: its styles must be an object literal or a constant object, or be computed from constants1`styled()` cannot use `<code>` at build time: its styles must be an object literal or a constant object, or be computed from constants
Trigger:
1import { styled } from '@devup-ui/react'; 2export const Card = styled.div({ _hover: rules });1import { styled } from '@devup-ui/react'; 2export const Card = styled.div({ _hover: rules });
Why: A whole runtime rule object has unknown keys, unlike a runtime value of a known property.
Fix: Keep the rule structure explicit. For runtime values, use a style prop such as <Box _hover={{ color }} />.
1import { styled } from '@devup-ui/react' 2export const Card = styled.div({ _hover: { color: 'red' } })1import { styled } from '@devup-ui/react' 2export const Card = styled.div({ _hover: { color: 'red' } })
Uncompilable styled composition
API: styled. Message pattern:
1Cannot compose `<styles>` at build time: each style must be a rule object, a class, or a condition choosing between them1Cannot compose `<styles>` at build time: each style must be a rule object, a class, or a condition choosing between them
Trigger:
1import { styled } from '@devup-ui/react'; 2export const Card = styled.div({ color: 'red' }, getStyles());1import { styled } from '@devup-ui/react'; 2export const Card = styled.div({ color: 'red' }, getStyles());
Why: An unknown function result cannot be split into stylesheet declarations.
Fix: Compose known objects/classes or conditions selecting them; express runtime differences as props.
1import { styled } from '@devup-ui/react' 2export const Card = styled.div({ color: 'red' }, { padding: '4px' })1import { styled } from '@devup-ui/react' 2export const Card = styled.div({ color: 'red' }, { padding: '4px' })
Unsupported shouldForwardProp predicate
API: styled. Message pattern:
1`styled()` cannot use `<code>` at build time: `shouldForwardProp` must be a function of the prop name that compares it with strings, `[...].includes(prop)`, `prop.startsWith(...)` or `isPropValid(prop)`, joined by `!`, `&&` and `||`1`styled()` cannot use `<code>` at build time: `shouldForwardProp` must be a function of the prop name that compares it with strings, `[...].includes(prop)`, `prop.startsWith(...)` or `isPropValid(prop)`, joined by `!`, `&&` and `||`
Trigger:
1import { styled } from '@devup-ui/react';
2export const Card = styled.div.withConfig({ shouldForwardProp: name => check(name) })({ color: 'red' });
1import { styled } from '@devup-ui/react';
2export const Card = styled.div.withConfig({ shouldForwardProp: name => check(name) })({ color: 'red' });
Why: The build evaluates the filter, so arbitrary runtime predicates cannot decide which props pass to the element.
Fix: Compare with strings, use includes, startsWith, or isPropValid, and combine them with !, &&, or ||.
1import { styled } from '@devup-ui/react'
2export const Card = styled.div.withConfig({
3 shouldForwardProp: (name) => name !== 'tone',
4})({ color: 'red' })
1import { styled } from '@devup-ui/react'
2export const Card = styled.div.withConfig({
3 shouldForwardProp: (name) => name !== 'tone',
4})({ color: 'red' })
shouldForwardProp calls the element argument
API: styled. Message pattern:
1`styled()` cannot use `<code>` at build time: styled-components v6 passes `shouldForwardProp` the element it renders as its second argument, not v5's validator, so calling it fails at runtime. Fix: call `isPropValid(prop)` from `@emotion/is-prop-valid`, or compare the prop with strings1`styled()` cannot use `<code>` at build time: styled-components v6 passes `shouldForwardProp` the element it renders as its second argument, not v5's validator, so calling it fails at runtime. Fix: call `isPropValid(prop)` from `@emotion/is-prop-valid`, or compare the prop with strings
Trigger:
1import styled from 'styled-components';
2export const Card = styled.div.withConfig({ shouldForwardProp: (prop, valid) => valid(prop) })`color: red;`;
1import styled from 'styled-components';
2export const Card = styled.div.withConfig({ shouldForwardProp: (prop, valid) => valid(prop) })`color: red;`;
Why: styled-components v6 calls shouldForwardProp(prop, elementToBeCreated). The second argument is the tag or component it renders, so calling it throws for a tag.
Fix: Call isPropValid from @emotion/is-prop-valid, or compare the prop with strings.
1import isPropValid from '@emotion/is-prop-valid'
2import styled from 'styled-components'
3export const Card = styled.div.withConfig({
4 shouldForwardProp: (prop) => isPropValid(prop),
5})`
6 color: red;
7`
1import isPropValid from '@emotion/is-prop-valid'
2import styled from 'styled-components'
3export const Card = styled.div.withConfig({
4 shouldForwardProp: (prop) => isPropValid(prop),
5})`
6 color: red;
7`
Unreadable styled identity option
API: styled. Message pattern:
1`styled()` cannot use `<code>` at build time: `target`, `componentId` and a `displayName` beside a `componentId` decide the classes the component renders; write them as literals 2`styled()` cannot use `<code>` at build time: styled-components throws on a `componentId` that is not a string; write it as a string 3`styled()` cannot use `<code>` at build time: styled-components throws on a truthy `displayName` that is not a string beside a `componentId`; write it as a string1`styled()` cannot use `<code>` at build time: `target`, `componentId` and a `displayName` beside a `componentId` decide the classes the component renders; write them as literals 2`styled()` cannot use `<code>` at build time: styled-components throws on a `componentId` that is not a string; write it as a string 3`styled()` cannot use `<code>` at build time: styled-components throws on a truthy `displayName` that is not a string beside a `componentId`; write it as a string
Trigger:
1import styled from 'styled-components' 2export const Card = styled.div.withConfig({ componentId: makeId() })` 3 color: red; 4`1import styled from 'styled-components' 2export const Card = styled.div.withConfig({ componentId: makeId() })` 3 color: red; 4`
Why: Emotion's target and styled-components' componentId (prefixed with displayName when both are set) become classes on the element, so the build must know their text. Any literal Emotion accepts compiles, '' included, which adds no class; styled-components throws on a componentId that is not a string, and on a truthy displayName that is not one beside it.
Fix: Write the option as a literal, a string for componentId and displayName.
1import styled from 'styled-components' 2export const Card = styled.div.withConfig({ componentId: 'card' })` 3 color: red; 4`1import styled from 'styled-components' 2export const Card = styled.div.withConfig({ componentId: 'card' })` 3 color: red; 4`
Unsupported withComponent target
API: styled. Message pattern:
1`withComponent()` cannot use `<code>` at build time: it takes one tag name, as `'aside'`, or a component written as a name or `a.b`, as the styled component compiles to a plain function with no `withComponent` at runtime. Fix: pass the tag or component directly, or render the styled component with `as` 2`withComponent()` cannot use `<code>` at build time: it takes one tag or component, as options beside it would give the component classes and props the build cannot see. Fix: pass the tag or component alone, or create the component with `styled(tag, options)`1`withComponent()` cannot use `<code>` at build time: it takes one tag name, as `'aside'`, or a component written as a name or `a.b`, as the styled component compiles to a plain function with no `withComponent` at runtime. Fix: pass the tag or component directly, or render the styled component with `as` 2`withComponent()` cannot use `<code>` at build time: it takes one tag or component, as options beside it would give the component classes and props the build cannot see. Fix: pass the tag or component alone, or create the component with `styled(tag, options)`
Trigger:
1import styled from '@emotion/styled' 2const Card = styled('div', { target: 'card' })` 3 color: red; 4` 5export const Link = Card.withComponent('a', { target: 'link' })1import styled from '@emotion/styled' 2const Card = styled('div', { target: 'card' })` 3 color: red; 4` 5export const Link = Card.withComponent('a', { target: 'link' })
Why: The build compiles withComponent into a component that renders the same classes on the new target. A component made with Devup UI's or styled-components' styled has no withComponent at runtime, so its target must be a tag name or a component written as a name or a.b. A component made with Emotion's styled takes any one target at runtime. Options given beside the target, such as a new target or shouldForwardProp, would change classes and props the build cannot see.
Fix: Pass the tag or component alone. For other options, create the component with styled(tag, options).
1import styled from '@emotion/styled' 2const Card = styled('div', { target: 'card' })` 3 color: red; 4` 5export const Link = styled('a', { target: 'link' })` 6 color: red; 7`1import styled from '@emotion/styled' 2const Card = styled('div', { target: 'card' })` 3 color: red; 4` 5export const Link = styled('a', { target: 'link' })` 6 color: red; 7`
Invalid selector in styled()
API: styled. Message pattern:
1`styled()` cannot use `<code>` at build time: a selector key names a pseudo-class or pseudo-element, as `_hover` or `hover`, or is a selector, as `&:hover`, `& > p` or `.parent &`1`styled()` cannot use `<code>` at build time: a selector key names a pseudo-class or pseudo-element, as `_hover` or `hover`, or is a selector, as `&:hover`, `& > p` or `.parent &`
Trigger:
1import { styled } from '@devup-ui/react'; 2export const Card = styled.div({ selectors: { nope: { color: 'red' } } });1import { styled } from '@devup-ui/react'; 2export const Card = styled.div({ selectors: { nope: { color: 'red' } } });
Why: The compiler cannot emit an unknown shorthand selector name.
Fix: Use a supported pseudo name or a full selector containing &.
1import { styled } from '@devup-ui/react' 2export const Card = styled.div({ selectors: { '&:hover': { color: 'red' } } })1import { styled } from '@devup-ui/react' 2export const Card = styled.div({ selectors: { '&:hover': { color: 'red' } } })
Emotion css prop and ClassNames
Unsupported css prop value
API: Emotion css prop and ClassNames. Message pattern:
1`css` on `<div>` cannot use `<code>` at build time: it must be a style object, CSS text, a class `css()` gives, or a function of the theme giving one, or an array or condition of them1`css` on `<div>` cannot use `<code>` at build time: it must be a style object, CSS text, a class `css()` gives, or a function of the theme giving one, or an array or condition of them
Trigger:
1import { css } from '@emotion/react';
2export const App = () => <div css={getStyles()} />;
1import { css } from '@emotion/react';
2export const App = () => <div css={getStyles()} />;
Why: The css prop needs a known rule structure, CSS text, or class, not an opaque runtime computation.
Fix: Use a style object, CSS text, a class from css(), a theme function giving one, or an array/condition of these.
1export const App = () => <div css={{ color: 'red' }} />
1export const App = () => <div css={{ color: 'red' }} />
Local style object hidden behind a binding
API: Emotion css prop and ClassNames. Message pattern:
1`css` on `<div>` cannot use `<code>` at build time: a style object it composes must be written in it, or declared with `const` at the top level of the module, where the build reads it1`css` on `<div>` cannot use `<code>` at build time: a style object it composes must be written in it, or declared with `const` at the top level of the module, where the build reads it
Trigger:
1import { css } from '@emotion/react';
2export function App() { let rules = { color: 'red' }; return <div css={rules} />; }
1import { css } from '@emotion/react';
2export function App() { let rules = { color: 'red' }; return <div css={rules} />; }
Why: The build reads a style object from a const binding, in the function or at the module top level. A let binding can be reassigned, so the build cannot tell its value from a class string.
Fix: Write the object directly in css, or declare it with const.
1const rules = { color: 'red' }
2export function App() {
3 return <div css={rules} />
4}
1const rules = { color: 'red' }
2export function App() {
3 return <div css={rules} />
4}
css prop overrides an opaque styled component
API: Emotion css prop and ClassNames. Message pattern:
1`css` on `<Card>` overrides styles `Card` sets, which the build orders only for a styled component rendering a tag with no attrs or props read, given no spread, `as` or `forwardedAs`: move these styles into `styled(Card)(...)`1`css` on `<Card>` overrides styles `Card` sets, which the build orders only for a styled component rendering a tag with no attrs or props read, given no spread, `as` or `forwardedAs`: move these styles into `styled(Card)(...)`
Trigger:
1import { css } from '@emotion/react';
2import styled from '@emotion/styled';
3const Card = styled.div.attrs({ title: 'card' })({ color: 'red' });
4export const App = () => <Card css={{ color: 'blue' }} />;
1import { css } from '@emotion/react';
2import styled from '@emotion/styled';
3const Card = styled.div.attrs({ title: 'card' })({ color: 'red' });
4export const App = () => <Card css={{ color: 'blue' }} />;
Why: Ordering is known only for a static styled tag with no attrs, props reads, spread, as, or forwardedAs.
Fix: Move the override into styled(Card)(...). A non-overlapping css prop does not need this ordering.
1import '@emotion/react' 2 3import styled from '@emotion/styled' 4const Card = styled.div.attrs({ title: 'card' })({ color: 'red' }) 5const BlueCard = styled(Card)({ color: 'blue' }) 6export const App = () => <BlueCard />1import '@emotion/react' 2 3import styled from '@emotion/styled' 4const Card = styled.div.attrs({ title: 'card' })({ color: 'red' }) 5const BlueCard = styled(Card)({ color: 'blue' }) 6export const App = () => <BlueCard />
css prop reads a choice of styles that other code also reads
API: Emotion css prop. Message pattern:
1`css` on `<div>` cannot use `<code>` at build time: it chooses among styles the build compiles only when `css` props alone read a `const` holding them: read it only as `css`, or write the choice in the prop1`css` on `<div>` cannot use `<code>` at build time: it chooses among styles the build compiles only when `css` props alone read a `const` holding them: read it only as `css`, or write the choice in the prop
Trigger:
1import { css } from '@emotion/react';
2export function App({ on }) { const rules = on ? { color: 'red' } : { color: 'blue' }; console.log(rules); return <div css={rules} />; }
1import { css } from '@emotion/react';
2export function App({ on }) { const rules = on ? { color: 'red' } : { color: 'blue' }; console.log(rules); return <div css={rules} />; }
Why: A const that chooses among style objects with ? :, &&, || or ?? compiles where it is declared: each object becomes the classes Emotion would give it, and the choice still runs at runtime. That is only safe when css props are the only readers. Other code would see class names instead of the objects. The same applies to a let.
Fix: Read the binding only as css, or write the choice in the prop.
1export function App({ on }) {
2 const rules = on ? { color: 'red' } : { color: 'blue' }
3 return <div css={rules} />
4}
1export function App({ on }) {
2 const rules = on ? { color: 'red' } : { color: 'blue' }
3 return <div css={rules} />
4}
css prop reads what a function returning styles gives
API: Emotion css prop. Message pattern:
1`css` on `<div>` cannot use `<code>` at build time: it holds what a call gives, and the function returns a style object, which the build does not run the call to read: write the styles in the prop or in a `const` it reads, or return a class `css()` gives1`css` on `<div>` cannot use `<code>` at build time: it holds what a call gives, and the function returns a style object, which the build does not run the call to read: write the styles in the prop or in a `const` it reads, or return a class `css()` gives
Trigger:
1import { css } from '@emotion/react';
2function make() { return { color: 'red' }; }
3export function App() { const rules = make(); return <div css={rules} />; }
1import { css } from '@emotion/react';
2function make() { return { color: 'red' }; }
3export function App() { const rules = make(); return <div css={rules} />; }
Why: The build does not run calls. A function of the module that returns an object or array literal gives styles, which a css prop cannot pass on as a class. A call the build cannot see into, such as a parameter or an import, is still passed on as a class.
Fix: Write the styles in the prop or in a const it reads, or have the function return a class from css().
1import { css } from '@emotion/react'
2const make = () => css({ color: 'red' })
3export function App() {
4 const rules = make()
5 return <div css={rules} />
6}
1import { css } from '@emotion/react'
2const make = () => css({ color: 'red' })
3export function App() {
4 const rules = make()
5 return <div css={rules} />
6}
ClassNames child cannot be compiled
API: Emotion css prop and ClassNames. Message pattern:
1`<ClassNames>` cannot use `<code>` at build time: it takes only a child function of `{ css, cx, theme }` giving what it renders at once1`<ClassNames>` cannot use `<code>` at build time: it takes only a child function of `{ css, cx, theme }` giving what it renders at once
Trigger:
1import { ClassNames } from '@emotion/react';
2export const App = () => <ClassNames>{render}</ClassNames>;
1import { ClassNames } from '@emotion/react';
2export const App = () => <ClassNames>{render}</ClassNames>;
Why: ClassNames is erased by compiling a single immediate child function; arbitrary children, attributes, async callbacks, and statement blocks cannot be erased that way.
Fix: Use one child function taking only { css, cx, theme } and returning what it renders immediately; remove ClassNames attributes.
1import { ClassNames } from '@emotion/react'
2export const App = () => (
3 <ClassNames>
4 {({ css }) => <div className={css({ color: 'red' })} />}
5 </ClassNames>
6)
1import { ClassNames } from '@emotion/react'
2export const App = () => (
3 <ClassNames>
4 {({ css }) => <div className={css({ color: 'red' })} />}
5 </ClassNames>
6)
ClassNames helper escapes its call
API: Emotion css prop and ClassNames. Message pattern:
1`<ClassNames>` cannot use `<code>` at build time: the `css` and `cx` its child function takes can only be called, as the build compiles each call1`<ClassNames>` cannot use `<code>` at build time: the `css` and `cx` its child function takes can only be called, as the build compiles each call
Trigger:
1import { css, ClassNames } from '@emotion/react';
2export const App = () => <ClassNames>{({ css }) => <div ref={css} />}</ClassNames>;
1import { css, ClassNames } from '@emotion/react';
2export const App = () => <ClassNames>{({ css }) => <div ref={css} />}</ClassNames>;
Why: The child helpers exist only while the build compiles their direct calls.
Fix: Call css/cx directly inside the child rather than passing, storing, or returning either helper.
1import { ClassNames } from '@emotion/react'
2export const App = () => (
3 <ClassNames>
4 {({ css }) => <div className={css({ color: 'red' })} />}
5 </ClassNames>
6)
1import { ClassNames } from '@emotion/react'
2export const App = () => (
3 <ClassNames>
4 {({ css }) => <div className={css({ color: 'red' })} />}
5 </ClassNames>
6)
ClassNames composes an unknown call
API: Emotion css prop and ClassNames. Message pattern:
1`<ClassNames>` cannot use `<code>` at build time: `css` and `cx` compose only style objects, CSS text, classes, calls of them, or arrays or conditions of these1`<ClassNames>` cannot use `<code>` at build time: `css` and `cx` compose only style objects, CSS text, classes, calls of them, or arrays or conditions of these
Trigger:
1import { ClassNames } from '@emotion/react';
2export const App = () => <ClassNames>{({ cx }) => <div className={cx(getClass())} />}</ClassNames>;
1import { ClassNames } from '@emotion/react';
2export const App = () => <ClassNames>{({ cx }) => <div className={cx(getClass())} />}</ClassNames>;
Why: The ClassNames composition reader cannot classify an arbitrary call as a class or style object.
Fix: Compute the class outside the child and pass its binding, or pass known objects/text/classes and direct css/cx calls.
1import { ClassNames } from '@emotion/react'
2export const App = () => (
3 <ClassNames>{({ cx }) => <div className={cx(className)} />}</ClassNames>
4)
1import { ClassNames } from '@emotion/react'
2export const App = () => (
3 <ClassNames>{({ cx }) => <div className={cx(className)} />}</ClassNames>
4)
ClassNames class map is not a data map
API: Emotion css prop and ClassNames. Message pattern:
1`<ClassNames>` cannot use `<code>` at build time: an object `cx` takes must give each class a condition, as `{ name: condition }`1`<ClassNames>` cannot use `<code>` at build time: an object `cx` takes must give each class a condition, as `{ name: condition }`
Trigger:
1import { ClassNames } from '@emotion/react';
2export const App = ({ classes }) => <ClassNames>{({ cx }) => <div className={cx({ ...classes })} />}</ClassNames>;
1import { ClassNames } from '@emotion/react';
2export const App = ({ classes }) => <ClassNames>{({ cx }) => <div className={cx({ ...classes })} />}</ClassNames>;
Why: A ClassNames class map must expose every class and its condition; opaque spreads/getters/methods hide those entries.
Fix: Use ordinary { name: condition } entries. Computed class keys are allowed when written explicitly.
1import { ClassNames } from '@emotion/react'
2export const App = ({ active }) => (
3 <ClassNames>{({ cx }) => <div className={cx({ active })} />}</ClassNames>
4)
1import { ClassNames } from '@emotion/react'
2export const App = ({ active }) => (
3 <ClassNames>{({ cx }) => <div className={cx({ active })} />}</ClassNames>
4)
CSS interpolation is neither value nor mixin
API: Emotion css prop and ClassNames. Message pattern:
1`css` on `<div>` cannot use `<code>` at build time: an interpolation in CSS text must be a value, or a mixin standing where a declaration would1`css` on `<div>` cannot use `<code>` at build time: an interpolation in CSS text must be a value, or a mixin standing where a declaration would
Trigger:
1import { css } from '@emotion/react';
2export const App = ({ selector }) => <div css={`& ${selector} { color: red; }`} />;
1import { css } from '@emotion/react';
2export const App = ({ selector }) => <div css={`& ${selector} { color: red; }`} />;
Why: An expression in selector/property syntax cannot become a declaration value or a separable mixin.
Fix: Keep selectors and property names literal or constant; place dynamic values after a property colon.
1export const App = () => ( 2 <div 3 css={` 4 & > p { 5 color: red; 6 } 7 `} 8 /> 9)1export const App = () => ( 2 <div 3 css={` 4 & > p { 5 color: red; 6 } 7 `} 8 /> 9)
Mixin inside a nested rule
API: Emotion css prop and ClassNames. Message pattern:
1`css` on `<div>` cannot use `<code>` at build time: a mixin must stand outside nested rules, where the parts it composes with can be split1`css` on `<div>` cannot use `<code>` at build time: a mixin must stand outside nested rules, where the parts it composes with can be split
Trigger:
1import { css } from '@emotion/react';
2export const App = ({ rules }) => <div css={css`&:hover { ${rules}; }`} />;
1import { css } from '@emotion/react';
2export const App = ({ rules }) => <div css={css`&:hover { ${rules}; }`} />;
Why: The compiler splits mixins into composition parts only outside nested rules.
Fix: Write the nested rule structure explicitly, or move a known mixin to the top-level declaration position.
1export const App = ({ color }) => <div css={{ '&:hover': { color } }} />
1export const App = ({ color }) => <div css={{ '&:hover': { color } }} />
Call cx instead of tagging a template
API: Emotion css prop and ClassNames. Message pattern:
1`cx()` cannot use `<code>` at build time: call it with class names, as in `cx('a', 'b')`1`cx()` cannot use `<code>` at build time: call it with class names, as in `cx('a', 'b')`
Trigger:
1import * as E from '@emotion/css'; 2export const a = E.cx`a b`;1import * as E from '@emotion/css'; 2export const a = E.cx`a b`;
Why: cx takes class-name arguments, not tagged CSS or class templates.
Fix: Use cx with explicit class string arguments.
1import * as E from '@emotion/css' 2export const a = E.cx('a', 'b')1import * as E from '@emotion/css' 2export const a = E.cx('a', 'b')
Call merge instead of tagging a template
API: Emotion css prop and ClassNames. Message pattern:
1`merge()` cannot use `<code>` at build time: call it with class names, as in `cx('a', 'b')`1`merge()` cannot use `<code>` at build time: call it with class names, as in `cx('a', 'b')`
Trigger:
1import * as E from '@emotion/css'; 2export const a = E.merge`a b`;1import * as E from '@emotion/css'; 2export const a = E.merge`a b`;
Why: merge takes one class string, not a tagged template.
Fix: Pass the template contents as one ordinary string argument.
1import * as E from '@emotion/css' 2export const a = E.merge('a b')1import * as E from '@emotion/css' 2export const a = E.merge('a b')
Replace class-map setters with condition properties
API: Emotion css prop and ClassNames. Message pattern:
1`cx()` cannot use `<code>` at build time: a class map entry must be written `name: condition`, not as a getter, setter or method1`cx()` cannot use `<code>` at build time: a class map entry must be written `name: condition`, not as a getter, setter or method
Trigger:
1import {cx} from '@emotion/css';
2export const a = () => cx({set b(v){}});
1import {cx} from '@emotion/css';
2export const a = () => cx({set b(v){}});
Why: A cx class map describes class-name conditions; accessors and methods are not condition entries.
Fix: Provide an explicit b: on condition instead of a setter.
1import { cx } from '@emotion/css'
2export const a = (on) => cx({ b: on })
1import { cx } from '@emotion/css'
2export const a = (on) => cx({ b: on })
Do not spread unresolved cx arguments
API: Emotion css prop and ClassNames. Message pattern:
1`cx()` cannot use `<code>` at build time: write every entry out, as its keys must be known1`cx()` cannot use `<code>` at build time: write every entry out, as its keys must be known
Trigger:
1import {cx} from '@emotion/css';
2export const a = list => cx(...list);
1import {cx} from '@emotion/css';
2export const a = list => cx(...list);
Why: The build cannot enumerate entries of an unresolved runtime spread.
Fix: For the illustrated fixed two-class shape, declare and pass each class argument explicitly; arbitrary runtime lists need a runtime class-string join.
1import { cx } from '@emotion/css'
2export const a = (first, second) => cx(first, second)
1import { cx } from '@emotion/css'
2export const a = (first, second) => cx(first, second)
Join runtime lists before calling merge
API: Emotion css prop and ClassNames. Message pattern:
1`merge()` cannot use `<code>` at build time: write every entry out, as its keys must be known1`merge()` cannot use `<code>` at build time: write every entry out, as its keys must be known
Trigger:
1import {merge} from '@emotion/css';
2export const a = list => merge(...list);
1import {merge} from '@emotion/css';
2export const a = list => merge(...list);
Why: The build cannot enumerate entries of an unresolved runtime spread.
Fix: Join the list into one class string, then pass that single string to merge.
1import { merge } from '@emotion/css'
2export const a = (list) => merge(list.join(' '))
1import { merge } from '@emotion/css'
2export const a = (list) => merge(list.join(' '))
Give merge exactly one argument, even for no classes
API: Emotion css prop and ClassNames. Message pattern:
1`merge()` cannot use `<code>` at build time: it takes one class string1`merge()` cannot use `<code>` at build time: it takes one class string
Trigger:
1import {merge} from '@emotion/css'; 2export const a = merge();1import {merge} from '@emotion/css'; 2export const a = merge();
Why: merge has a one-class-string argument contract.
Fix: Pass an empty string for an intentionally empty result.
1import { merge } from '@emotion/css' 2export const a = merge('')1import { merge } from '@emotion/css' 2export const a = merge('')
Use build-time values in css rules
API: Emotion css prop and ClassNames. Message pattern:
1`css()` cannot use `<code>` at build time: its values must be literals, theme tokens or constants, or be computed from them1`css()` cannot use `<code>` at build time: its values must be literals, theme tokens or constants, or be computed from them
Trigger:
1import * as E from '@emotion/css'; 2export const a = E.css({color:unknown});1import * as E from '@emotion/css'; 2export const a = E.css({color:unknown});
Why: There is no rendered element on which this compile-time API can place a dynamic CSS variable.
Fix: Replace the unresolved value with a literal, theme token or constant.
1import * as E from '@emotion/css' 2export const a = E.css({ color: 'red' })1import * as E from '@emotion/css' 2export const a = E.css({ color: 'red' })
Use build-time values in keyframe rules
API: Emotion css prop and ClassNames. Message pattern:
1`keyframes()` cannot use `<code>` at build time: its values must be literals, theme tokens or constants, or be computed from them1`keyframes()` cannot use `<code>` at build time: its values must be literals, theme tokens or constants, or be computed from them
Trigger:
1import * as E from '@emotion/css'; 2export const a = E.keyframes({from:{opacity:unknown}});1import * as E from '@emotion/css'; 2export const a = E.keyframes({from:{opacity:unknown}});
Why: There is no rendered element on which this compile-time API can place a dynamic CSS variable.
Fix: Use a literal opacity value in the keyframe.
1import * as E from '@emotion/css' 2export const a = E.keyframes({ from: { opacity: 0 } })1import * as E from '@emotion/css' 2export const a = E.keyframes({ from: { opacity: 0 } })
Use build-time values in injected global rules
API: Emotion css prop and ClassNames. Message pattern:
1`globalCss()` cannot use `<code>` at build time: its values must be literals, theme tokens or constants, or be computed from them1`globalCss()` cannot use `<code>` at build time: its values must be literals, theme tokens or constants, or be computed from them
Trigger:
1import * as E from '@emotion/css';
2E.injectGlobal({body:{color:unknown}});
1import * as E from '@emotion/css';
2E.injectGlobal({body:{color:unknown}});
Why: There is no rendered element on which this compile-time API can place a dynamic CSS variable.
Fix: Use a literal global color value.
1import * as E from '@emotion/css'
2E.injectGlobal({ body: { color: 'red' } })
1import * as E from '@emotion/css'
2E.injectGlobal({ body: { color: 'red' } })
Do not pass mutated rule objects to css
API: Emotion css prop and ClassNames. Message pattern:
1`css()` cannot use `<code>` at build time: its styles must be an object literal or a constant object, or be computed from constants 2`<binding>` is changed here, so the build cannot read it as a constant1`css()` cannot use `<code>` at build time: its styles must be an object literal or a constant object, or be computed from constants 2`<binding>` is changed here, so the build cannot read it as a constant
Trigger:
1import * as E from '@emotion/css'; 2const rules = {color:'red'}; 3rules.color = 'blue'; 4export const a = E.css(rules);1import * as E from '@emotion/css'; 2const rules = {color:'red'}; 3rules.color = 'blue'; 4export const a = E.css(rules);
Why: A rule object changed by running code is not a build-time constant.
Fix: Construct the final rule object without mutations before the css call.
1import * as E from '@emotion/css' 2const rules = { color: 'blue' } 3export const a = E.css(rules)1import * as E from '@emotion/css' 2const rules = { color: 'blue' } 3export const a = E.css(rules)
Compose known rule objects instead of spreading runtime styles
API: Emotion css prop and ClassNames. Message pattern:
1Cannot compose `<styles>` at build time: each style must be a rule object, a class, or a condition choosing between them1Cannot compose `<styles>` at build time: each style must be a rule object, a class, or a condition choosing between them
Trigger:
1import * as E from '@emotion/css';
2export const a = styles => E.css(...styles);
1import * as E from '@emotion/css';
2export const a = styles => E.css(...styles);
Why: Each composed style must have a build-time-readable rule or class shape.
Fix: For a known composition, write each rule object out explicitly.
1import * as E from '@emotion/css' 2export const a = E.css({ color: 'red' }, { padding: 8 })1import * as E from '@emotion/css' 2export const a = E.css({ color: 'red' }, { padding: 8 })
Keep template selector interpolations constant
API: Emotion css prop and ClassNames. Message pattern:
1Cannot place `<expression>` at build time: an interpolation in a selector or a property name must be a literal or a constant1Cannot place `<expression>` at build time: an interpolation in a selector or a property name must be a literal or a constant
Trigger:
1import * as E from '@emotion/css'; 2export const a = E.css`.${unknown}{color:red}`;1import * as E from '@emotion/css'; 2export const a = E.css`.${unknown}{color:red}`;
Why: A runtime selector interpolation cannot determine the CSS rule to emit.
Fix: Write the selector as literal text, or interpolate a build-time constant.
1import * as E from '@emotion/css' 2export const a = E.css`.selected{color:red}`1import * as E from '@emotion/css' 2export const a = E.css`.selected{color:red}`
Theme reads
Whole-theme or computed theme read in styled
API: Theme reads. Message pattern:
1`styled()` cannot use `<code>` at build time: a theme read must be a path of names or literal keys, such as `p => p.theme.colors.brand` or `({ theme }) => theme.space[2]`, which reads the CSS variable `ThemeProvider` declares; compute other values outside the style1`styled()` cannot use `<code>` at build time: a theme read must be a path of names or literal keys, such as `p => p.theme.colors.brand` or `({ theme }) => theme.space[2]`, which reads the CSS variable `ThemeProvider` declares; compute other values outside the style
Trigger:
1import styled from 'styled-components'; 2export const Card = styled.div`color: ${props => props.theme};`;1import styled from 'styled-components'; 2export const Card = styled.div`color: ${props => props.theme};`;
Why: The compatibility theme is represented by CSS variables, not a runtime theme object available to style functions.
Fix: Read a path of property names or literal keys, such as props.theme.colors.brand or theme.space[2]. Compute other values outside the style.
1import styled from 'styled-components' 2export const Card = styled.div` 3 color: ${(props) => props.theme.colors.brand}; 4`1import styled from 'styled-components' 2export const Card = styled.div` 3 color: ${(props) => props.theme.colors.brand}; 4`
Theme function does not immediately return rules
API: Theme reads. Message pattern:
1`css` on `<div>` cannot use `<code>` at build time: a function of the theme must give its rules at once, as `theme => ({ ... })`1`css` on `<div>` cannot use `<code>` at build time: a function of the theme must give its rules at once, as `theme => ({ ... })`
Trigger:
1import { css } from '@emotion/react'; 2export const App = () => <div css={theme => { const rules = { color: theme.color }; return rules; }} />;1import { css } from '@emotion/react'; 2export const App = () => <div css={theme => { const rules = { color: theme.color }; return rules; }} />;
Why: The build rewrites the function result and needs one immediate expression or a single return statement.
Fix: Use theme => ({ ... }) or a non-async function with a single return. Keep other computations outside.
1export const App = () => <div css={(theme) => ({ color: theme.color })} />1export const App = () => <div css={(theme) => ({ color: theme.color })} />
Theme read outside a declaration value
API: Theme reads. Message pattern:
1`css` on `<div>` cannot use `<code>` at build time: it may read the theme only as `theme.a.b` in a value, which becomes the CSS variable `var(--a-b)` the `ThemeProvider` sets1`css` on `<div>` cannot use `<code>` at build time: it may read the theme only as `theme.a.b` in a value, which becomes the CSS variable `var(--a-b)` the `ThemeProvider` sets
Trigger:
1import { css } from '@emotion/react';
2export const App = () => <div css={theme => ({ color: theme.pick() })} />;
1import { css } from '@emotion/react';
2export const App = () => <div css={theme => ({ color: theme.pick() })} />;
Why: Only a static path in a declaration value maps to a ThemeProvider CSS variable.
Fix: Read theme.a.b or a literal index/key. Do not read the whole object, call it, use runtime keys, or use theme values as selector names.
1export const App = () => ( 2 <div css={(theme) => ({ color: theme.colors.brand })} /> 3)1export const App = () => ( 2 <div css={(theme) => ({ color: theme.colors.brand })} /> 3)
ClassNames theme read outside CSS
API: Theme reads. Message pattern:
1`<ClassNames>` cannot use `<code>` at build time: it may read the theme only as `theme.a.b` in a value, which becomes the CSS variable `var(--a-b)` the `ThemeProvider` sets1`<ClassNames>` cannot use `<code>` at build time: it may read the theme only as `theme.a.b` in a value, which becomes the CSS variable `var(--a-b)` the `ThemeProvider` sets
Trigger:
1import { ClassNames } from '@emotion/react';
2export const App = () => <ClassNames>{({ theme }) => <div title={theme.name} />}</ClassNames>;
1import { ClassNames } from '@emotion/react';
2export const App = () => <ClassNames>{({ theme }) => <div title={theme.name} />}</ClassNames>;
Why: The ClassNames theme binding only becomes a CSS variable when used as a style value, not as an ordinary HTML attribute.
Fix: Use a static theme path inside css(), or pass non-style data from a real runtime binding outside ClassNames.
1import { ClassNames } from '@emotion/react'
2export const App = () => (
3 <ClassNames>
4 {({ css, theme }) => <div className={css({ color: theme.colors.brand })} />}
5 </ClassNames>
6)
1import { ClassNames } from '@emotion/react'
2export const App = () => (
3 <ClassNames>
4 {({ css, theme }) => <div className={css({ color: theme.colors.brand })} />}
5 </ClassNames>
6)
Imports and barrels
Reading an API imported through a barrel as a runtime value
API: Imports and barrels. Message pattern:
1`<binding>` is read at runtime, where it does not exist: the build compiles it only where it is called or rendered1`<binding>` is read at runtime, where it does not exist: the build compiles it only where it is called or rendered
Trigger:
1import { css } from './ui'; 2export const a = [css];1import { css } from './ui'; 2export const a = [css];
Companion-module fixture: The imports above are resolved from these additional source modules. Before/after keys, where present, identify the failing and repaired resolver inputs.
1{ 2 "ui.ts": "export { css } from '@devup-ui/react';\n" 3}1{ 2 "ui.ts": "export { css } from '@devup-ui/react';\n" 3}
Why: Following a barrel does not make a compile-time API into a runtime value.
Fix: Call the resolved API; the barrel import itself is supported.
1import { css } from './ui' 2export const a = css({ color: 'red' })1import { css } from './ui' 2export const a = css({ color: 'red' })
Use a namespace instead of a root default import
API: Imports and barrels. Message pattern:
1`@emotion/css()` cannot use `<code>` at build time: the root module has no default export; use named or namespace imports1`@emotion/css()` cannot use `<code>` at build time: the root module has no default export; use named or namespace imports
Trigger:
1import E from '@emotion/css';1import E from '@emotion/css';
Why: The @emotion/css root module has no default export.
Fix: Import the namespace and call its css member directly.
1import * as E from '@emotion/css' 2export const a = E.css({ color: 'red' })1import * as E from '@emotion/css' 2export const a = E.css({ color: 'red' })
Do not import the named default export
API: Imports and barrels. Message pattern:
1`@emotion/css()` cannot use `<code>` at build time: the root module has no default export1`@emotion/css()` cannot use `<code>` at build time: the root module has no default export
Trigger:
1import {default as E} from '@emotion/css';1import {default as E} from '@emotion/css';
Why: The root has no export named default either.
Fix: Import the named css API and export its compiled result.
1import { css } from '@emotion/css' 2export const a = css({ color: 'red' })1import { css } from '@emotion/css' 2export const a = css({ color: 'red' })
Do not forward every Emotion export
API: Imports and barrels. Message pattern:
1`@emotion/css()` cannot use `<code>` at build time: a namespace containing styling functions cannot be re-exported1`@emotion/css()` cannot use `<code>` at build time: a namespace containing styling functions cannot be re-exported
Trigger:
1export * from '@emotion/css';
1export * from '@emotion/css';
Why: Styling functions are compiled away and cannot be provided as runtime exports.
Fix: Explicitly re-export only runtime members such as flush and cache.
1export { cache, flush } from '@emotion/css'
1export { cache, flush } from '@emotion/css'
Export a compiled class, not the css function
API: Imports and barrels. Message pattern:
1`@emotion/css()` cannot use `<code>` at build time: styling functions cannot be re-exported1`@emotion/css()` cannot use `<code>` at build time: styling functions cannot be re-exported
Trigger:
1export {css} from '@emotion/css';
1export {css} from '@emotion/css';
Why: Styling functions are compiled away and cannot be provided as runtime exports.
Fix: Import css locally, call it, and export the resulting class string.
1import { css } from '@emotion/css' 2export const red = css({ color: 'red' })1import { css } from '@emotion/css' 2export const red = css({ color: 'red' })
Do not export a require import-equals namespace
API: Imports and barrels. Message pattern:
1`@emotion/css()` cannot use `<code>` at build time: a namespace containing styling functions cannot be exported1`@emotion/css()` cannot use `<code>` at build time: a namespace containing styling functions cannot be exported
Trigger:
1export import E = require('@emotion/css');1export import E = require('@emotion/css');
Why: The namespace contains compile-time styling functions, not a general-purpose runtime object.
Fix: Replace the namespace export with explicit runtime-only ES re-exports.
1export { cache, flush } from '@emotion/css'
1export { cache, flush } from '@emotion/css'
Keep namespace aliases local
API: Imports and barrels. Message pattern:
1`@emotion/css()` cannot use `<code>` at build time: namespace and styling function bindings cannot be exported1`@emotion/css()` cannot use `<code>` at build time: namespace and styling function bindings cannot be exported
Trigger:
1import * as E from '@emotion/css'; 2export const N = E;1import * as E from '@emotion/css'; 2export const N = E;
Why: The namespace contains compile-time styling functions, not a general-purpose runtime object.
Fix: Declare the namespace alias locally and export only a compiled class.
1import * as E from '@emotion/css' 2const N = E 3export const red = N.css({ color: 'red' })1import * as E from '@emotion/css' 2const N = E 3export const red = N.css({ color: 'red' })
Do not export an imported namespace binding
API: Imports and barrels. Message pattern:
1`@emotion/css()` cannot use `<code>` at build time: a namespace may only be read through statically known members or const aliases1`@emotion/css()` cannot use `<code>` at build time: a namespace may only be read through statically known members or const aliases
Trigger:
1import * as E from '@emotion/css'; 2export {E};1import * as E from '@emotion/css'; 2export {E};
Why: The namespace contains compile-time styling functions, not a general-purpose runtime object.
Fix: Call a static member and export its compiled result.
1import * as E from '@emotion/css' 2export const red = E.css({ color: 'red' })1import * as E from '@emotion/css' 2export const red = E.css({ color: 'red' })
Call styling functions without optional invocation
API: Imports and barrels. Message pattern:
1`@emotion/css()` cannot use `<code>` at build time: styling functions must be called directly, not mutated, exported or passed as values1`@emotion/css()` cannot use `<code>` at build time: styling functions must be called directly, not mutated, exported or passed as values
Trigger:
1import * as E from '@emotion/css'; 2E.css?.({});1import * as E from '@emotion/css'; 2E.css?.({});
Why: An optional call is not a direct compile-time invocation.
Fix: Remove optional invocation and call the API directly.
1import * as E from '@emotion/css' 2export const red = E.css({ color: 'red' })1import * as E from '@emotion/css' 2export const red = E.css({ color: 'red' })
Use const for namespace aliases
API: Imports and barrels. Message pattern:
1`@emotion/css()` cannot use `<code>` at build time: namespace and styling aliases must be simple const bindings 2`@emotion/css()` cannot use `<code>` at build time: a namespace may only be read through statically known members or const aliases1`@emotion/css()` cannot use `<code>` at build time: namespace and styling aliases must be simple const bindings 2`@emotion/css()` cannot use `<code>` at build time: a namespace may only be read through statically known members or const aliases
Trigger:
1import * as E from '@emotion/css'; 2let N = E;1import * as E from '@emotion/css'; 2let N = E;
Why: The build follows and eliminates only simple const namespace or styling aliases.
Fix: Replace let with const and access a known member.
1import * as E from '@emotion/css' 2const N = E 3export const red = N.css({ color: 'red' })1import * as E from '@emotion/css' 2const N = E 3export const red = N.css({ color: 'red' })
Use const for styling aliases
API: Imports and barrels. Message pattern:
1`@emotion/css()` cannot use `<code>` at build time: namespace and styling aliases must be simple const bindings 2`@emotion/css()` cannot use `<code>` at build time: styling functions must be called directly, not mutated, exported or passed as values1`@emotion/css()` cannot use `<code>` at build time: namespace and styling aliases must be simple const bindings 2`@emotion/css()` cannot use `<code>` at build time: styling functions must be called directly, not mutated, exported or passed as values
Trigger:
1import * as E from '@emotion/css'; 2let c = E.css;1import * as E from '@emotion/css'; 2let c = E.css;
Why: The build follows and eliminates only simple const namespace or styling aliases.
Fix: Bind the styling member with const and call it directly.
1import * as E from '@emotion/css' 2const c = E.css 3export const red = c({ color: 'red' })1import * as E from '@emotion/css' 2const c = E.css 3export const red = c({ color: 'red' })
Name namespace members instead of using rest
API: Imports and barrels. Message pattern:
1`@emotion/css()` cannot use `<code>` at build time: namespace rest destructuring can expose styling functions1`@emotion/css()` cannot use `<code>` at build time: namespace rest destructuring can expose styling functions
Trigger:
1import * as E from '@emotion/css'; 2const {...rest} = E;1import * as E from '@emotion/css'; 2const {...rest} = E;
Why: Namespace rest can expose styling functions to runtime code.
Fix: List only the required runtime-only members explicitly.
1import * as E from '@emotion/css' 2const { flush, cache } = E 3flush() 4console.info(cache)1import * as E from '@emotion/css' 2const { flush, cache } = E 3flush() 4console.info(cache)
Use constant strings for destructuring keys
API: Imports and barrels. Message pattern:
1`@emotion/css()` cannot use `<code>` at build time: destructuring keys must be constant strings1`@emotion/css()` cannot use `<code>` at build time: destructuring keys must be constant strings
Trigger:
1import * as E from '@emotion/css'; 2const {[key]: c} = E;1import * as E from '@emotion/css'; 2const {[key]: c} = E;
Why: The normalizer must determine which API a destructuring property names.
Fix: Declare the string key as a const before the destructuring.
1import * as E from '@emotion/css' 2const key = 'css' 3const { [key]: c } = E 4export const red = c({ color: 'red' })1import * as E from '@emotion/css' 2const key = 'css' 3const { [key]: c } = E 4export const red = c({ color: 'red' })
Do not default a destructured styling function
API: Imports and barrels. Message pattern:
1`@emotion/css()` cannot use `<code>` at build time: use a plain binding without defaults or nested patterns1`@emotion/css()` cannot use `<code>` at build time: use a plain binding without defaults or nested patterns
Trigger:
1import * as E from '@emotion/css'; 2const {css = other} = E;1import * as E from '@emotion/css'; 2const {css = other} = E;
Why: A fallback would give an eliminated macro binding a runtime meaning.
Fix: Use a plain binding without a default, then call it directly.
1import * as E from '@emotion/css' 2const { css } = E 3export const red = css({ color: 'red' })1import * as E from '@emotion/css' 2const { css } = E 3export const red = css({ color: 'red' })
Read only recognized Emotion namespace members
API: Imports and barrels. Message pattern:
1`@emotion/css()` cannot use `<code>` at build time: use a supported styling API or a runtime-only Emotion export1`@emotion/css()` cannot use `<code>` at build time: use a supported styling API or a runtime-only Emotion export
Trigger:
1import * as E from '@emotion/css'; 2E.unknown({});1import * as E from '@emotion/css'; 2E.unknown({});
Why: The build recognizes css, cx, merge, keyframes, injectGlobal and the runtime members cache, flush, hydrate, sheet and getRegisteredStyles.
Fix: Use a supported styling member such as css.
1import * as E from '@emotion/css' 2export const red = E.css({ color: 'red' })1import * as E from '@emotion/css' 2export const red = E.css({ color: 'red' })
Initialize namespace aliases in dependency order
API: Imports and barrels. Message pattern:
1`@emotion/css()` cannot use `<code>` at build time: an alias must be initialized before any read that can run first; declare it above the earliest code that can reach this read1`@emotion/css()` cannot use `<code>` at build time: an alias must be initialized before any read that can run first; declare it above the earliest code that can reach this read
Trigger:
1import * as E from '@emotion/css'; 2const N = A; 3const A = E;1import * as E from '@emotion/css'; 2const N = A; 3const A = E;
Why: Eliminating an alias must not hide a read that can occur in its temporal dead zone.
Fix: Declare the source namespace alias before aliases derived from it.
1import * as E from '@emotion/css' 2const A = E 3const N = A 4export const red = N.css({ color: 'red' })1import * as E from '@emotion/css' 2const A = E 3const N = A 4export const red = N.css({ color: 'red' })
Use a statically known namespace API key
API: Imports and barrels. Message pattern:
1`@emotion/css()` cannot use `<code>` at build time: namespace member keys must be constant strings1`@emotion/css()` cannot use `<code>` at build time: namespace member keys must be constant strings
Trigger:
1import * as E from '@emotion/css'; 2E[key]({color:'red'});1import * as E from '@emotion/css'; 2E[key]({color:'red'});
Why: A runtime key cannot determine which styling import must be generated.
Fix: Use a const string key initialized before the read.
1import * as E from '@emotion/css' 2const key = 'css' 3export const red = E[key]({ color: 'red' })1import * as E from '@emotion/css' 2const key = 'css' 3export const red = E[key]({ color: 'red' })
Do not optional-chain a namespace styling read
API: Imports and barrels. Message pattern:
1`@emotion/css()` cannot use `<code>` at build time: optional namespace reads cannot be compiled1`@emotion/css()` cannot use `<code>` at build time: optional namespace reads cannot be compiled
Trigger:
1import * as E from '@emotion/css'; 2E?.css({});1import * as E from '@emotion/css'; 2E?.css({});
Why: Optional namespace styling reads cannot be lowered to unconditional generated imports.
Fix: Use a normal static member call.
1import * as E from '@emotion/css' 2export const red = E.css({ color: 'red' })1import * as E from '@emotion/css' 2export const red = E.css({ color: 'red' })
Do not load styling APIs through module.require
API: Imports and barrels. Message pattern:
1`@emotion/css()` cannot use `<code>` at build time: styling APIs read through require(), import-equals or dynamic import cannot be compiled; use `import * as ns from '@emotion/css'`1`@emotion/css()` cannot use `<code>` at build time: styling APIs read through require(), import-equals or dynamic import cannot be compiled; use `import * as ns from '@emotion/css'`
Trigger:
1const E = module.require('@emotion/css'); 2E.cx('a');1const E = module.require('@emotion/css'); 2E.cx('a');
Why: A runtime loader does not provide the static ES imports needed for build-time styling extraction.
Fix: Use a static namespace import before calling cx.
1import * as E from '@emotion/css' 2export const a = E.cx('a')1import * as E from '@emotion/css' 2export const a = E.cx('a')
Await dynamic imports directly for runtime-only use
API: Imports and barrels. Message pattern:
1`@emotion/css()` cannot use `<code>` at build time: a dynamic import hands out a runtime namespace; `await` it directly for runtime-only members, or use `import * as ns from '@emotion/css'`1`@emotion/css()` cannot use `<code>` at build time: a dynamic import hands out a runtime namespace; `await` it directly for runtime-only members, or use `import * as ns from '@emotion/css'`
Trigger:
1const p = import('@emotion/css');1const p = import('@emotion/css');
Why: A stored import promise is rejected even if no styling member is visibly read.
Fix: Await the import directly and read only a runtime-only member.
1const E = await import('@emotion/css') 2E.flush()1const E = await import('@emotion/css') 2E.flush()
Source that does not parse
API: Any file the build compiles. Message pattern:
1Cannot parse source: <parser message>. Fix: correct the syntax at this location1Cannot parse source: <parser message>. Fix: correct the syntax at this location
Trigger:
1import * as E from '@emotion/css'; 2E.__emotion_user(); const broken;1import * as E from '@emotion/css'; 2E.__emotion_user(); const broken;
Why: The build reads a file only once it parses. A syntax error is reported first, at its location, before any style diagnostic of the same file.
Fix: Correct the syntax at the reported location, then fix any style diagnostic the build reports next.
A production next build first extracts every source file of the project, including files no route imports. A file it cannot extract there does not fail the build: the plugin prints a warning naming the file and the error, [devup-ui] Turbopack prewarm of <file> failed: <message>. ... (or [devup-ui] webpack stylesheet warm-up of <file> failed: <message>. ... with webpack), and skips it. If Next.js compiles that file, the build still fails with the error above.
1import * as E from '@emotion/css' 2export const red = E.css({ color: 'red' })1import * as E from '@emotion/css' 2export const red = E.css({ color: 'red' })
Array destructuring a namespace
API: Imports and barrels. Message pattern:
1`Devup` cannot use `<code>` at build time: read its members by name, as `Devup.css`, `Devup['css']` or `const { css } = Devup`, or import them by name1`Devup` cannot use `<code>` at build time: read its members by name, as `Devup.css`, `Devup['css']` or `const { css } = Devup`, or import them by name
Trigger:
1import * as Devup from '@devup-ui/react'; 2const [a] = Devup;1import * as Devup from '@devup-ui/react'; 2const [a] = Devup;
Why: The namespace rewrite requires an exact member or a simple, unmixed object destructure; it cannot rewrite this shape.
Fix: Read the desired API by name, rather than destructuring the namespace as an array.
1import * as Devup from '@devup-ui/react' 2export const a = Devup.css({ color: 'red' })1import * as Devup from '@devup-ui/react' 2export const a = Devup.css({ color: 'red' })
Writing a followed const API alias in a function
API: Imports and barrels. Message pattern:
1`c` cannot use `<code>` at build time: read its members by name, as `c.css`, `c['css']` or `const { css } = c`, or import them by name1`c` cannot use `<code>` at build time: read its members by name, as `c.css`, `c['css']` or `const { css } = c`, or import them by name
Trigger:
1import { css } from '@devup-ui/react';
2export function f() { const c = css; c = () => 1; return c({ color: "red" }); }
1import { css } from '@devup-ui/react';
2export function f() { const c = css; c = () => 1; return c({ color: "red" }); }
Why: A followed alias cannot be reassigned after the rewrite removes its declaration.
Fix: Call the imported css directly instead of creating a local runtime alias.
1import { css } from '@devup-ui/react'
2export function f() {
3 return css({ color: 'red' })
4}
1import { css } from '@devup-ui/react'
2export function f() {
3 return css({ color: 'red' })
4}
Writing a member through a const namespace alias
API: Imports and barrels. Message pattern:
1`D` cannot use `<code>` at build time: read its members by name, as `D.css`, `D['css']` or `const { css } = D`, or import them by name1`D` cannot use `<code>` at build time: read its members by name, as `D.css`, `D['css']` or `const { css } = D`, or import them by name
Trigger:
1import * as Devup from '@devup-ui/react';
2const D = Devup;
3D.css = () => 1;
1import * as Devup from '@devup-ui/react';
2const D = Devup;
3D.css = () => 1;
Why: Const namespace aliases are followed, so member writes use the same unreadable-namespace diagnostic.
Fix: Keep the namespace alias immutable and only read exact members.
1import * as Devup from '@devup-ui/react' 2const D = Devup 3export const a = D.css({ color: 'red' })1import * as Devup from '@devup-ui/react' 2const D = Devup 3export const a = D.css({ color: 'red' })
Reading a css result before its declaration executes
API: Imports and barrels. Message pattern:
1`css()` cannot use `<code>` at build time: it is read before `const k = css(…)` runs, so move that declaration above where it is first read1`css()` cannot use `<code>` at build time: it is read before `const k = css(…)` runs, so move that declaration above where it is first read
Trigger:
1import { css } from '@devup-ui/react'; 2export const a = k; 3const k = css({ color: 'red' });1import { css } from '@devup-ui/react'; 2export const a = k; 3const k = css({ color: 'red' });
Why: An eager top-level read precedes the const initializer; only deferred function reads of literal style constants may be hoisted.
Fix: Move the initializer above the first eager read.
1import { css } from '@devup-ui/react' 2const k = css({ color: 'red' }) 3export const a = k1import { css } from '@devup-ui/react' 2const k = css({ color: 'red' }) 3export const a = k
Reading a keyframes result before its declaration executes
API: Imports and barrels. Message pattern:
1`keyframes()` cannot use `<code>` at build time: it is read before `const k = keyframes(…)` runs, so move that declaration above where it is first read1`keyframes()` cannot use `<code>` at build time: it is read before `const k = keyframes(…)` runs, so move that declaration above where it is first read
Trigger:
1import { keyframes } from '@devup-ui/react'; 2export const a = k; 3const k = keyframes({ from: { opacity: 0 } });1import { keyframes } from '@devup-ui/react'; 2export const a = k; 3const k = keyframes({ from: { opacity: 0 } });
Why: An eager top-level read precedes the const initializer; only deferred function reads of literal style constants may be hoisted.
Fix: Move the initializer above the first eager read.
1import { keyframes } from '@devup-ui/react' 2const k = keyframes({ from: { opacity: 0 } }) 3export const a = k1import { keyframes } from '@devup-ui/react' 2const k = keyframes({ from: { opacity: 0 } }) 3export const a = k
Unresolved star re-export in a barrel that reaches Devup UI
API: Imports and barrels. Message pattern:
1`Foo` cannot use `<code>` at build time: the build cannot follow its re-export of Devup UI (`./missing` cannot be read); import it from the package instead1`Foo` cannot use `<code>` at build time: the build cannot follow its re-export of Devup UI (`./missing` cannot be read); import it from the package instead
Trigger:
1import { Foo } from './ui'; 2export const a = <Foo />;1import { Foo } from './ui'; 2export const a = <Foo />;
Companion-module fixture: The imports above are resolved from these additional source modules. Before/after keys, where present, identify the failing and repaired resolver inputs.
1{ 2 "ui.ts": "export * from './missing';\nexport { Box } from '@devup-ui/react';\n" 3}1{ 2 "ui.ts": "export * from './missing';\nexport { Box } from '@devup-ui/react';\n" 3}
Why: The barrel mentions the package but the missing re-export cannot be read by the resolver.
Fix: Import the desired compile-time member directly from the package, or make the re-export resolvable.
1import { Box } from '@devup-ui/react' 2export const a = <Box bg="red" />1import { Box } from '@devup-ui/react' 2export const a = <Box bg="red" />
Unresolved default re-export reports every value use
API: Imports and barrels. Message pattern:
1`Page` cannot use `<code>` at build time: the build cannot follow its re-export of Devup UI (`./missing` cannot be read); import it from the package instead 2`Page` cannot use `<code>` at build time: the build cannot follow its re-export of Devup UI (`./missing` cannot be read); import it from the package instead1`Page` cannot use `<code>` at build time: the build cannot follow its re-export of Devup UI (`./missing` cannot be read); import it from the package instead 2`Page` cannot use `<code>` at build time: the build cannot follow its re-export of Devup UI (`./missing` cannot be read); import it from the package instead
Trigger:
1import Page from './ui'; 2export const a = [Page, Page];1import Page from './ui'; 2export const a = [Page, Page];
Companion-module fixture: The imports above are resolved from these additional source modules. Before/after keys, where present, identify the failing and repaired resolver inputs.
1{ 2 "ui.ts": "export { default } from './missing';\nexport { Box } from '@devup-ui/react';\n" 3}1{ 2 "ui.ts": "export { default } from './missing';\nexport { Box } from '@devup-ui/react';\n" 3}
Why: Each value reference of the opaque default import has its own source location.
Fix: Replace the opaque default import with a known named package import.
1import { Box } from '@devup-ui/react' 2export const a = <Box bg="red" />1import { Box } from '@devup-ui/react' 2export const a = <Box bg="red" />
Unresolved member of a barrel namespace
API: Imports and barrels. Message pattern:
1`UI.nothing` cannot use `<code>` at build time: the build cannot follow its re-export of Devup UI (`./missing` cannot be read); import it from the package instead1`UI.nothing` cannot use `<code>` at build time: the build cannot follow its re-export of Devup UI (`./missing` cannot be read); import it from the package instead
Trigger:
1import * as UI from './ui'; 2export const a = UI.nothing;1import * as UI from './ui'; 2export const a = UI.nothing;
Companion-module fixture: The imports above are resolved from these additional source modules. Before/after keys, where present, identify the failing and repaired resolver inputs.
1{ 2 "ui.ts": "export * from './missing';\nexport { Box } from '@devup-ui/react';\n" 3}1{ 2 "ui.ts": "export * from './missing';\nexport { Box } from '@devup-ui/react';\n" 3}
Why: The namespace member leads through an unreadable star re-export.
Fix: Read a known package export directly rather than an unresolved barrel member.
1import { Box } from '@devup-ui/react' 2export const a = <Box bg="red" />1import { Box } from '@devup-ui/react' 2export const a = <Box bg="red" />
Destructuring an unresolved barrel member
API: Imports and barrels. Message pattern:
1`{ nothing } = UI` cannot use `<code>` at build time: the build cannot follow its re-export of Devup UI (`./missing` cannot be read); import it from the package instead1`{ nothing } = UI` cannot use `<code>` at build time: the build cannot follow its re-export of Devup UI (`./missing` cannot be read); import it from the package instead
Trigger:
1import * as UI from './ui'; 2const { nothing } = UI; 3export const a = nothing;1import * as UI from './ui'; 2const { nothing } = UI; 3export const a = nothing;
Companion-module fixture: The imports above are resolved from these additional source modules. Before/after keys, where present, identify the failing and repaired resolver inputs.
1{ 2 "ui.ts": "export * from './missing';\nexport { Box } from '@devup-ui/react';\n" 3}1{ 2 "ui.ts": "export * from './missing';\nexport { Box } from '@devup-ui/react';\n" 3}
Why: Destructuring must resolve each compiled member to its package origin.
Fix: Import a known member from the package or repair the barrel chain.
1import { Box } from '@devup-ui/react' 2export const a = <Box bg="red" />1import { Box } from '@devup-ui/react' 2export const a = <Box bg="red" />
Namespace re-export of a module that itself re-exports Devup UI
API: Imports and barrels. Message pattern:
1`inner` cannot use `<code>` at build time: the build cannot follow its re-export of Devup UI (`./inner` is a namespace of modules re-exporting `@devup-ui/react`); import it from the package instead1`inner` cannot use `<code>` at build time: the build cannot follow its re-export of Devup UI (`./inner` is a namespace of modules re-exporting `@devup-ui/react`); import it from the package instead
Trigger:
1import { inner } from './ui'; 2export const a = <inner.Box />;1import { inner } from './ui'; 2export const a = <inner.Box />;
Companion-module fixture: The imports above are resolved from these additional source modules. Before/after keys, where present, identify the failing and repaired resolver inputs.
1{ 2 "ui.ts": "export * as inner from './inner';\n", 3 "inner.ts": "export { Box } from '@devup-ui/react';\n" 4}1{ 2 "ui.ts": "export * as inner from './inner';\n", 3 "inner.ts": "export { Box } from '@devup-ui/react';\n" 4}
Why: A module namespace whose contents re-export the package is not a single exact package namespace.
Fix: Import the component from the package instead of passing through a module namespace.
1import { Box } from '@devup-ui/react' 2export const a = <Box bg="red" />1import { Box } from '@devup-ui/react' 2export const a = <Box bg="red" />
Nested module namespace read through an outer namespace
API: Imports and barrels. Message pattern:
1`UI.inner` cannot use `<code>` at build time: the build cannot follow its re-export of Devup UI (`./inner` is a namespace of modules re-exporting `@devup-ui/react`); import it from the package instead1`UI.inner` cannot use `<code>` at build time: the build cannot follow its re-export of Devup UI (`./inner` is a namespace of modules re-exporting `@devup-ui/react`); import it from the package instead
Trigger:
1import * as UI from './ui'; 2export const a = UI.inner;1import * as UI from './ui'; 2export const a = UI.inner;
Companion-module fixture: The imports above are resolved from these additional source modules. Before/after keys, where present, identify the failing and repaired resolver inputs.
1{ 2 "ui.ts": "export * as inner from './inner';\n", 3 "inner.ts": "export { Box } from '@devup-ui/react';\n" 4}1{ 2 "ui.ts": "export * as inner from './inner';\n", 3 "inner.ts": "export { Box } from '@devup-ui/react';\n" 4}
Why: The outer namespace member names a module namespace re-exporting the package.
Fix: Import the exact package member directly.
1import { Box } from '@devup-ui/react' 2export const a = <Box bg="red" />1import { Box } from '@devup-ui/react' 2export const a = <Box bg="red" />
Destructuring a nested module namespace
API: Imports and barrels. Message pattern:
1`{ inner } = UI` cannot use `<code>` at build time: the build cannot follow its re-export of Devup UI (`./inner` is a namespace of modules re-exporting `@devup-ui/react`); import it from the package instead1`{ inner } = UI` cannot use `<code>` at build time: the build cannot follow its re-export of Devup UI (`./inner` is a namespace of modules re-exporting `@devup-ui/react`); import it from the package instead
Trigger:
1import * as UI from './ui'; 2const { inner } = UI; 3export const a = inner;1import * as UI from './ui'; 2const { inner } = UI; 3export const a = inner;
Companion-module fixture: The imports above are resolved from these additional source modules. Before/after keys, where present, identify the failing and repaired resolver inputs.
1{ 2 "ui.ts": "export * as inner from './inner';\n", 3 "inner.ts": "export { Box } from '@devup-ui/react';\n" 4}1{ 2 "ui.ts": "export * as inner from './inner';\n", 3 "inner.ts": "export { Box } from '@devup-ui/react';\n" 4}
Why: The destructured member is a namespace of modules, rather than a supported exact package origin.
Fix: Import the exact package component directly.
1import { Box } from '@devup-ui/react' 2export const a = <Box bg="red" />1import { Box } from '@devup-ui/react' 2export const a = <Box bg="red" />
Mixed compiled and locally declared barrel members
API: Imports and barrels. Message pattern:
1`UI` cannot use `<code>` at build time: read its members by name, as `UI.css`, `UI['css']` or `const { css } = UI`, or import them by name1`UI` cannot use `<code>` at build time: read its members by name, as `UI.css`, `UI['css']` or `const { css } = UI`, or import them by name
Trigger:
1import * as UI from './ui'; 2const { Box, own } = UI; 3export const a = <Box>{own}</Box>;1import * as UI from './ui'; 2const { Box, own } = UI; 3export const a = <Box>{own}</Box>;
Companion-module fixture: The imports above are resolved from these additional source modules. Before/after keys, where present, identify the failing and repaired resolver inputs.
1{ 2 "ui.ts": "export { Box } from '@devup-ui/react';\nexport const own = 1;\n" 3}1{ 2 "ui.ts": "export { Box } from '@devup-ui/react';\nexport const own = 1;\n" 3}
Why: A destructuring declaration containing both compiled imports and retained barrel values cannot be removed as a whole.
Fix: Keep local/runtime members in their own destructure and read compiled members by name.
1import * as UI from './ui' 2const { own } = UI 3export const a = <UI.Box>{own}</UI.Box>1import * as UI from './ui' 2const { own } = UI 3export const a = <UI.Box>{own}</UI.Box>
Runtime-only options
StyleSheetManager and CacheProvider are inert under the aliases, so an option that changes the CSS or the props they would produce is a located error instead of being dropped. Options such as target, nonce, key or prepend only steer runtime insertion and stay accepted.
StyleSheetManager option dropped at runtime
API: styled-components. Message pattern:
1`stylisPlugins` of `StyleSheetManager` from `styled-components` runs stylis plugins over the CSS at runtime, which Devup UI does not compile, so the plugins would never reach the stylesheet. Fix: write the CSS the plugins would produce into the styles, or set `importAliases: { 'styled-components': false }` and build with styled-components1`stylisPlugins` of `StyleSheetManager` from `styled-components` runs stylis plugins over the CSS at runtime, which Devup UI does not compile, so the plugins would never reach the stylesheet. Fix: write the CSS the plugins would produce into the styles, or set `importAliases: { 'styled-components': false }` and build with styled-components
shouldForwardProp (filters at runtime the props every styled component passes on) and namespace (prefixes every selector at runtime) report the same shape, as does a JSX spread on the manager (takes spread props, so whether they set ... cannot be known at build time).
Trigger:
1import { StyleSheetManager } from 'styled-components';
2export const App = ({ children }) => (
3 <StyleSheetManager stylisPlugins={[rtlPlugin]} shouldForwardProp={isPropValid}>{children}</StyleSheetManager>
4);
1import { StyleSheetManager } from 'styled-components';
2export const App = ({ children }) => (
3 <StyleSheetManager stylisPlugins={[rtlPlugin]} shouldForwardProp={isPropValid}>{children}</StyleSheetManager>
4);
Why: Devup UI writes every rule at build time and has no stylis pass, so the manager's plugins and prop filter would silently do nothing.
Fix: Write the CSS the plugin would produce, such as logical properties instead of an RTL plugin, and give each styled component its own shouldForwardProp through .withConfig().
1import { styled } from 'styled-components'
2export const Card = styled.div.withConfig({
3 shouldForwardProp: (name) => name !== 'tone',
4})({ marginInlineStart: 8 })
1import { styled } from 'styled-components'
2export const Card = styled.div.withConfig({
3 shouldForwardProp: (name) => name !== 'tone',
4})({ marginInlineStart: 8 })
createCache stylisPlugins
API: Emotion. Message pattern:
1`stylisPlugins` of `createCache()` from `@emotion/cache` runs stylis plugins over the CSS at runtime, which Devup UI does not compile, so the plugins would never reach the stylesheet. Fix: write the CSS the plugins would produce into the styles, or set `importAliases: { '@emotion/react': false, '@emotion/styled': false }` and build with Emotion1`stylisPlugins` of `createCache()` from `@emotion/cache` runs stylis plugins over the CSS at runtime, which Devup UI does not compile, so the plugins would never reach the stylesheet. Fix: write the CSS the plugins would produce into the styles, or set `importAliases: { '@emotion/react': false, '@emotion/styled': false }` and build with Emotion
Reported while @emotion/react or @emotion/styled is aliased, as their CacheProvider takes the cache.
Trigger:
1import createCache from '@emotion/cache';
2import { CacheProvider } from '@emotion/react';
3const cache = createCache({ key: 'rtl', stylisPlugins: [rtlPlugin] });
4export const App = ({ children }) => <CacheProvider value={cache}>{children}</CacheProvider>;
1import createCache from '@emotion/cache';
2import { CacheProvider } from '@emotion/react';
3const cache = createCache({ key: 'rtl', stylisPlugins: [rtlPlugin] });
4export const App = ({ children }) => <CacheProvider value={cache}>{children}</CacheProvider>;
Why: CacheProvider is inert, so the plugins would never run.
Fix: Write the CSS the plugin would produce. A cache without stylisPlugins is accepted.
1import createCache from '@emotion/cache'
2import { CacheProvider } from '@emotion/react'
3const cache = createCache({ key: 'app' })
4export const App = ({ children }) => (
5 <CacheProvider value={cache}>{children}</CacheProvider>
6)
1import createCache from '@emotion/cache'
2import { CacheProvider } from '@emotion/react'
3const cache = createCache({ key: 'app' })
4export const App = ({ children }) => (
5 <CacheProvider value={cache}>{children}</CacheProvider>
6)
createCache options that cannot be read
API: Emotion. Message pattern:
1<what>, so whether the options of `createCache()` set `stylisPlugins`, which Devup UI does not compile, cannot be known at build time. Fix: `import createCache from '@emotion/cache'` and call it with an object literal of options, or set `importAliases: { '@emotion/react': false, '@emotion/styled': false }` and build with Emotion1<what>, so whether the options of `createCache()` set `stylisPlugins`, which Devup UI does not compile, cannot be known at build time. Fix: `import createCache from '@emotion/cache'` and call it with an object literal of options, or set `importAliases: { '@emotion/react': false, '@emotion/styled': false }` and build with Emotion
<what> is one of:
`createCache()` from `@emotion/cache` takes options that are not an object literal`createCache()` from `@emotion/cache` takes spread options`createCache()` from `@emotion/cache` takes an option of a computed key`createCache` from `@emotion/cache` is used other than by calling it`@emotion/cache` is loaded other than by an import of its default export(a namespace or named import,require(),import()or a re-export)
Trigger:
1import createCache from '@emotion/cache'; 2export const cache = createCache(options);1import createCache from '@emotion/cache'; 2export const cache = createCache(options);
Why: The build must see every key of the options to know that none of them is stylisPlugins.
Fix: Pass the options as an object literal.
1import createCache from '@emotion/cache' 2export const cache = createCache({ key: 'app' })1import createCache from '@emotion/cache' 2export const cache = createCache({ key: 'app' })
vanilla-extract
Recipes value import
API: vanilla-extract. Message pattern:
1`@vanilla-extract/recipes` generates CSS that Devup UI does not compile, so with the `@vanilla-extract/css` alias its rules would never reach the stylesheet. Fix: write the styles with `css()`, or set `importAliases: { '@vanilla-extract/css': false }` and build with the vanilla-extract plugin1`@vanilla-extract/recipes` generates CSS that Devup UI does not compile, so with the `@vanilla-extract/css` alias its rules would never reach the stylesheet. Fix: write the styles with `css()`, or set `importAliases: { '@vanilla-extract/css': false }` and build with the vanilla-extract plugin
Trigger:
1import { recipe } from '@vanilla-extract/recipes'; 2export const button = recipe({ base: { color: 'red' }, variants: { size: { small: { padding: 4 }, large: { padding: 8 } } } });1import { recipe } from '@vanilla-extract/recipes'; 2export const button = recipe({ base: { color: 'red' }, variants: { size: { small: { padding: 4 }, large: { padding: 8 } } } });
Why: On the companion branch, a non-type recipes import while the vanilla CSS alias is active is rejected before stylesheet execution. The authored message includes original filename:line:column. This replaces silent pass-through on the scoped snapshot.
Fix: Replace the companion-generated styles with css(); this example covers one selected variant, not recipe runtime behavior.
1import { css } from '@devup-ui/react' 2export const button = css({ color: 'red', padding: '4px' })1import { css } from '@devup-ui/react' 2export const button = css({ color: 'red', padding: '4px' })
Sprinkles value import
API: vanilla-extract. Message pattern:
1`@vanilla-extract/sprinkles` generates CSS that Devup UI does not compile, so with the `@vanilla-extract/css` alias its rules would never reach the stylesheet. Fix: write the styles with `css()`, or set `importAliases: { '@vanilla-extract/css': false }` and build with the vanilla-extract plugin1`@vanilla-extract/sprinkles` generates CSS that Devup UI does not compile, so with the `@vanilla-extract/css` alias its rules would never reach the stylesheet. Fix: write the styles with `css()`, or set `importAliases: { '@vanilla-extract/css': false }` and build with the vanilla-extract plugin
Trigger:
1import { defineProperties, createSprinkles } from '@vanilla-extract/sprinkles'; 2const properties = defineProperties({ properties: { color: ['red', 'blue'] } }); 3export const sprinkles = createSprinkles(properties); 4export const red = sprinkles({ color: 'red' });1import { defineProperties, createSprinkles } from '@vanilla-extract/sprinkles'; 2const properties = defineProperties({ properties: { color: ['red', 'blue'] } }); 3export const sprinkles = createSprinkles(properties); 4export const red = sprinkles({ color: 'red' });
Why: On the companion branch, a non-type sprinkles import while the vanilla CSS alias is active is rejected before stylesheet execution. The authored message includes original filename:line:column. This replaces silent pass-through on the scoped snapshot.
Fix: Replace the selected style with css(); this is not a full sprinkles runtime API replacement.
1import { css } from '@devup-ui/react' 2export const red = css({ color: 'red' })1import { css } from '@devup-ui/react' 2export const red = css({ color: 'red' })
StyleX
Static namespaces need known declarations. Dynamic namespaces expose direct parameters as CSS variables; compute a derived value before passing it to that namespace. props() and attrs() compose the extracted classes. Helpers are interpreted only in their supported contexts.
create(): array argument shape
API: StyleX. Message pattern:
1`stylex.create()` cannot use `<code>` at build time: it takes one object literal1`stylex.create()` cannot use `<code>` at build time: it takes one object literal
Trigger:
1import * as stylex from '@stylexjs/stylex';
2export function example() {
3 const result = stylex.create([]);
4 return result;
5}
1import * as stylex from '@stylexjs/stylex';
2export function example() {
3 const result = stylex.create([]);
4 return result;
5}
Why: The scoped extractor lowers this API only when its argument list has the exact object-literal shape. Runtime inputs cannot become an extracted declaration or namespace map.
Fix: Pass the object literal directly with the required number of arguments, rather than a runtime value or argument spread.
1import * as stylex from '@stylexjs/stylex'
2export function example() {
3 const result = stylex.create({ base: { color: 'red' } })
4 return result
5}
1import * as stylex from '@stylexjs/stylex'
2export function example() {
3 const result = stylex.create({ base: { color: 'red' } })
4 return result
5}
defineVars(): array argument shape
API: StyleX. Message pattern:
1`stylex.defineVars()` cannot use `<code>` at build time: it takes one object literal1`stylex.defineVars()` cannot use `<code>` at build time: it takes one object literal
Trigger:
1import * as stylex from '@stylexjs/stylex';
2export function example() {
3 const result = stylex.defineVars([]);
4 return result;
5}
1import * as stylex from '@stylexjs/stylex';
2export function example() {
3 const result = stylex.defineVars([]);
4 return result;
5}
Why: The scoped extractor lowers this API only when its argument list has the exact object-literal shape. Runtime inputs cannot become an extracted declaration or namespace map.
Fix: Pass the object literal directly with the required number of arguments, rather than a runtime value or argument spread.
1import * as stylex from '@stylexjs/stylex'
2export function example() {
3 const result = stylex.defineVars({ color: 'red' })
4 return result
5}
1import * as stylex from '@stylexjs/stylex'
2export function example() {
3 const result = stylex.defineVars({ color: 'red' })
4 return result
5}
defineConsts(): array argument shape
API: StyleX. Message pattern:
1`stylex.defineConsts()` cannot use `<code>` at build time: it takes one object literal1`stylex.defineConsts()` cannot use `<code>` at build time: it takes one object literal
Trigger:
1import * as stylex from '@stylexjs/stylex';
2export function example() {
3 const result = stylex.defineConsts([]);
4 return result;
5}
1import * as stylex from '@stylexjs/stylex';
2export function example() {
3 const result = stylex.defineConsts([]);
4 return result;
5}
Why: The scoped extractor lowers this API only when its argument list has the exact object-literal shape. Runtime inputs cannot become an extracted declaration or namespace map.
Fix: Pass the object literal directly with the required number of arguments, rather than a runtime value or argument spread.
1import * as stylex from '@stylexjs/stylex'
2export function example() {
3 const result = stylex.defineConsts({ color: 'red' })
4 return result
5}
1import * as stylex from '@stylexjs/stylex'
2export function example() {
3 const result = stylex.defineConsts({ color: 'red' })
4 return result
5}
createThemeContract(): array argument shape
API: StyleX. Message pattern:
1`stylex.createThemeContract()` cannot use `<code>` at build time: it takes one object literal1`stylex.createThemeContract()` cannot use `<code>` at build time: it takes one object literal
Trigger:
1import * as stylex from '@stylexjs/stylex';
2export function example() {
3 const result = stylex.createThemeContract([]);
4 return result;
5}
1import * as stylex from '@stylexjs/stylex';
2export function example() {
3 const result = stylex.createThemeContract([]);
4 return result;
5}
Why: The scoped extractor lowers this API only when its argument list has the exact object-literal shape. Runtime inputs cannot become an extracted declaration or namespace map.
Fix: Pass the object literal directly with the required number of arguments, rather than a runtime value or argument spread.
1import * as stylex from '@stylexjs/stylex'
2export function example() {
3 const result = stylex.createThemeContract({ color: null })
4 return result
5}
1import * as stylex from '@stylexjs/stylex'
2export function example() {
3 const result = stylex.createThemeContract({ color: null })
4 return result
5}
positionTry(): array argument shape
API: StyleX. Message pattern:
1`stylex.positionTry()` cannot use `<code>` at build time: it takes one object literal1`stylex.positionTry()` cannot use `<code>` at build time: it takes one object literal
Trigger:
1import * as stylex from '@stylexjs/stylex';
2export function example() {
3 const result = stylex.positionTry([]);
4 return result;
5}
1import * as stylex from '@stylexjs/stylex';
2export function example() {
3 const result = stylex.positionTry([]);
4 return result;
5}
Why: The scoped extractor lowers this API only when its argument list has the exact object-literal shape. Runtime inputs cannot become an extracted declaration or namespace map.
Fix: Pass the object literal directly with the required number of arguments, rather than a runtime value or argument spread.
1import * as stylex from '@stylexjs/stylex'
2export function example() {
3 const result = stylex.positionTry({ top: 0 })
4 return result
5}
1import * as stylex from '@stylexjs/stylex'
2export function example() {
3 const result = stylex.positionTry({ top: 0 })
4 return result
5}
viewTransitionClass(): array argument shape
API: StyleX. Message pattern:
1`stylex.viewTransitionClass()` cannot use `<code>` at build time: it takes one object literal1`stylex.viewTransitionClass()` cannot use `<code>` at build time: it takes one object literal
Trigger:
1import * as stylex from '@stylexjs/stylex';
2export function example() {
3 const result = stylex.viewTransitionClass([]);
4 return result;
5}
1import * as stylex from '@stylexjs/stylex';
2export function example() {
3 const result = stylex.viewTransitionClass([]);
4 return result;
5}
Why: The scoped extractor lowers this API only when its argument list has the exact object-literal shape. Runtime inputs cannot become an extracted declaration or namespace map.
Fix: Pass the object literal directly with the required number of arguments, rather than a runtime value or argument spread.
1import * as stylex from '@stylexjs/stylex'
2export function example() {
3 const result = stylex.viewTransitionClass({ old: { opacity: 0 } })
4 return result
5}
1import * as stylex from '@stylexjs/stylex'
2export function example() {
3 const result = stylex.viewTransitionClass({ old: { opacity: 0 } })
4 return result
5}
keyframes(): array argument shape
API: StyleX. Message pattern:
1`stylex.keyframes()` cannot use `<code>` at build time: it takes one object literal1`stylex.keyframes()` cannot use `<code>` at build time: it takes one object literal
Trigger:
1import * as stylex from '@stylexjs/stylex';
2export function example() {
3 const result = stylex.keyframes([]);
4 return result;
5}
1import * as stylex from '@stylexjs/stylex';
2export function example() {
3 const result = stylex.keyframes([]);
4 return result;
5}
Why: The scoped extractor lowers this API only when its argument list has the exact object-literal shape. Runtime inputs cannot become an extracted declaration or namespace map.
Fix: Pass the object literal directly with the required number of arguments, rather than a runtime value or argument spread.
1import * as stylex from '@stylexjs/stylex'
2export function example() {
3 const result = stylex.keyframes({ from: { opacity: 0 }, to: { opacity: 1 } })
4 return result
5}
1import * as stylex from '@stylexjs/stylex'
2export function example() {
3 const result = stylex.keyframes({ from: { opacity: 0 }, to: { opacity: 1 } })
4 return result
5}
createTheme(): spread-argument argument shape
API: StyleX. Message pattern:
1`stylex.createTheme()` cannot use `<code>` at build time: it takes a `defineVars()` group, of this file or imported, and an object literal1`stylex.createTheme()` cannot use `<code>` at build time: it takes a `defineVars()` group, of this file or imported, and an object literal
Trigger:
1import * as stylex from '@stylexjs/stylex';
2const vars = stylex.defineVars({ color: 'red' });
3export function example(args) {
4 const result = stylex.createTheme(...args);
5 return result;
6}
1import * as stylex from '@stylexjs/stylex';
2const vars = stylex.defineVars({ color: 'red' });
3export function example(args) {
4 const result = stylex.createTheme(...args);
5 return result;
6}
Why: createTheme needs an identifier bound to a defineVars/createThemeContract group known by the visitor, followed by an object literal of overrides. An arbitrary object or runtime reference is not a registered contract.
Fix: Define the contract first, bind it to one identifier, and pass that identifier with one override object.
1import * as stylex from '@stylexjs/stylex'
2const vars = stylex.defineVars({ color: 'red' })
3export function example() {
4 const result = stylex.createTheme(vars, { color: 'blue' })
5 return result
6}
1import * as stylex from '@stylexjs/stylex'
2const vars = stylex.defineVars({ color: 'red' })
3export function example() {
4 const result = stylex.createTheme(vars, { color: 'blue' })
5 return result
6}
Array destructuring cannot bind create() namespaces
API: StyleX. Message pattern:
1`stylex.create()` cannot be destructured at build time: assign it to one variable, as `const styles = stylex.create({ ... })`1`stylex.create()` cannot be destructured at build time: assign it to one variable, as `const styles = stylex.create({ ... })`
Trigger:
1import * as stylex from '@stylexjs/stylex'; 2export const [base] = stylex.create({ base: { color: 'red' } });1import * as stylex from '@stylexjs/stylex'; 2export const [base] = stylex.create({ base: { color: 'red' } });
Why: The extractor associates a namespace map with one variable binding. Destructuring the create result prevents that map from being registered for props/attrs and includes.
Fix: Assign create() to styles and read styles.base instead of destructuring the declaration.
1import * as stylex from '@stylexjs/stylex' 2export const styles = stylex.create({ base: { color: 'red' } })1import * as stylex from '@stylexjs/stylex' 2export const styles = stylex.create({ base: { color: 'red' } })
create(): scalar namespace
API: StyleX. Message pattern:
1`stylex.create()` cannot use `<code>` at build time: a namespace is an object of styles or an arrow function returning one1`stylex.create()` cannot use `<code>` at build time: a namespace is an object of styles or an arrow function returning one
Trigger:
1import * as stylex from '@stylexjs/stylex';
2export function example() {
3 const result = stylex.create({ base: 'red' });
4 return result;
5}
1import * as stylex from '@stylexjs/stylex';
2export function example() {
3 const result = stylex.create({ base: 'red' });
4 return result;
5}
Why: Every create() entry is a namespace, not an individual CSS value. The supported namespace forms are an object of styles, an object-returning arrow, or null (empty namespace).
Fix: Put CSS declarations inside a namespace object, or use a supported dynamic arrow.
1import * as stylex from '@stylexjs/stylex'
2export function example() {
3 const result = stylex.create({ base: { color: 'red' } })
4 return result
5}
1import * as stylex from '@stylexjs/stylex'
2export function example() {
3 const result = stylex.create({ base: { color: 'red' } })
4 return result
5}
Dynamic arrow: scalar-return
API: StyleX. Message pattern:
1`stylex.create()` cannot use `<code>` at build time: a dynamic style is an arrow function with plain parameters returning an object literal1`stylex.create()` cannot use `<code>` at build time: a dynamic style is an arrow function with plain parameters returning an object literal
Trigger:
1import * as stylex from '@stylexjs/stylex';
2export function example() {
3 const result = stylex.create({ base: (color) => color });
4 return result;
5}
1import * as stylex from '@stylexjs/stylex';
2export function example() {
3 const result = stylex.create({ base: (color) => color });
4 return result;
5}
Why: Dynamic namespace extraction reads plain parameter identifiers and an arrow expression whose body is an object literal. It does not execute a function body or destructuring pattern.
Fix: Use (value) => ({ color: value }) with a plain identifier parameter and expression body.
1import * as stylex from '@stylexjs/stylex'
2export function example() {
3 const result = stylex.create({ base: (color) => ({ color }) })
4 return result
5}
1import * as stylex from '@stylexjs/stylex'
2export function example() {
3 const result = stylex.create({ base: (color) => ({ color }) })
4 return result
5}
Dynamic namespace value: runtime
API: StyleX. Message pattern:
1`stylex.create()` cannot use `<code>` at build time: a dynamic style's value is one of its parameters or a static value; compute it before passing it1`stylex.create()` cannot use `<code>` at build time: a dynamic style's value is one of its parameters or a static value; compute it before passing it
Trigger:
1import * as stylex from '@stylexjs/stylex';
2export function example(value) {
3 const result = stylex.create({ base: (width) => ({ width: value }) });
4 return result;
5}
1import * as stylex from '@stylexjs/stylex';
2export function example(value) {
3 const result = stylex.create({ base: (width) => ({ width: value }) });
4 return result;
5}
Why: A dynamic namespace value can directly name one of its parameters or be static. Arithmetic, member reads, conditions and helper calls inside that arrow are not evaluated as dynamic CSS expressions.
Fix: Compute the desired value at the call site and pass it to a plain parameter referenced directly by the style property.
1import * as stylex from '@stylexjs/stylex'
2export function example() {
3 const result = stylex.create({ base: (width) => ({ width }) })
4 return result
5}
1import * as stylex from '@stylexjs/stylex'
2export function example() {
3 const result = stylex.create({ base: (width) => ({ width }) })
4 return result
5}
Static style value: identifier
API: StyleX. Message pattern:
1`stylex.create()` cannot use `<code>` at build time: its values must be literals, theme tokens or constants, or be computed from them1`stylex.create()` cannot use `<code>` at build time: its values must be literals, theme tokens or constants, or be computed from them
Trigger:
1import * as stylex from '@stylexjs/stylex';
2export function example(value) {
3 const result = stylex.create({ base: { color: value } });
4 return result;
5}
1import * as stylex from '@stylexjs/stylex';
2export function example(value) {
3 const result = stylex.create({ base: { color: value } });
4 return result;
5}
Why: A static namespace has no runtime CSS variable assignment. Its leaf values must resolve at build time: literals, constants/computations the evaluator can fold, registered keyframe names or defineVars/defineConsts member references.
Fix: Use a literal or resolvable constant; for genuinely runtime input, use a dynamic namespace parameter.
1import * as stylex from '@stylexjs/stylex'
2export function example() {
3 const result = stylex.create({ base: { color: 'red' } })
4 return result
5}
1import * as stylex from '@stylexjs/stylex'
2export function example() {
3 const result = stylex.create({ base: { color: 'red' } })
4 return result
5}
Condition key: ordinary
API: StyleX. Message pattern:
1`stylex.create()` cannot use `<code>` at build time: a condition is `default`, a pseudo-class, a pseudo-element or an `@media`, `@supports` or `@container` rule1`stylex.create()` cannot use `<code>` at build time: a condition is `default`, a pseudo-class, a pseudo-element or an `@media`, `@supports` or `@container` rule
Trigger:
1import * as stylex from '@stylexjs/stylex';
2export function example() {
3 const result = stylex.create({ base: { color: { 'hover': 'red' } } });
4 return result;
5}
1import * as stylex from '@stylexjs/stylex';
2export function example() {
3 const result = stylex.create({ base: { color: { 'hover': 'red' } } });
4 return result;
5}
Why: A value-level object is interpreted as conditions, not an arbitrary nested value. Its keys must be default, a colon-prefixed pseudo-class/element, or an @media/@supports/@container rule.
Fix: Replace the invalid condition with default or a supported pseudo/at-rule condition.
1import * as stylex from '@stylexjs/stylex'
2export function example() {
3 const result = stylex.create({
4 base: { color: { default: 'red', ':hover': 'blue' } },
5 })
6 return result
7}
1import * as stylex from '@stylexjs/stylex'
2export function example() {
3 const result = stylex.create({
4 base: { color: { default: 'red', ':hover': 'blue' } },
5 })
6 return result
7}
Pseudo selector: element-array
API: StyleX. Message pattern:
1`stylex.create()` cannot use `<code>` at build time: a pseudo-class or pseudo-element key takes an object of styles1`stylex.create()` cannot use `<code>` at build time: a pseudo-class or pseudo-element key takes an object of styles
Trigger:
1import * as stylex from '@stylexjs/stylex';
2export function example() {
3 const result = stylex.create({ base: { '::before': [] } });
4 return result;
5}
1import * as stylex from '@stylexjs/stylex';
2export function example() {
3 const result = stylex.create({ base: { '::before': [] } });
4 return result;
5}
Why: A top-level colon-prefixed namespace key denotes a pseudo selector whose value must be an object of CSS declarations. A scalar belongs under a property-level condition instead.
Fix: Use { ":hover": { color: "red" } } or { color: { ":hover": "red" } }.
1import * as stylex from '@stylexjs/stylex'
2export function example() {
3 const result = stylex.create({ base: { '::before': { color: 'red' } } })
4 return result
5}
1import * as stylex from '@stylexjs/stylex'
2export function example() {
3 const result = stylex.create({ base: { '::before': { color: 'red' } } })
4 return result
5}
create(): spread in namespace-map
API: StyleX. Message pattern:
1`stylex.create()` cannot use `<code>` at build time: write every entry out, as its keys must be known1`stylex.create()` cannot use `<code>` at build time: write every entry out, as its keys must be known
Trigger:
1import * as stylex from '@stylexjs/stylex';
2export function example(extra) {
3 const result = stylex.create({ ...extra });
4 return result;
5}
1import * as stylex from '@stylexjs/stylex';
2export function example(extra) {
3 const result = stylex.create({ ...extra });
4 return result;
5}
Why: This StyleX object layer does not accept unresolved object spreads: the build needs each key. The sole namespace-level exception is a recognized ...include(styles.base) reference to an earlier local create namespace.
Fix: Write the entries explicitly; for namespace composition, spread include() with an earlier same-file namespace.
1import * as stylex from '@stylexjs/stylex'
2export function example() {
3 const result = stylex.create({ base: { color: 'red' } })
4 return result
5}
1import * as stylex from '@stylexjs/stylex'
2export function example() {
3 const result = stylex.create({ base: { color: 'red' } })
4 return result
5}
create(): computed key in namespace-map
API: StyleX. Message pattern:
1`stylex.create()` cannot use `<code>` at build time: its keys must be known1`stylex.create()` cannot use `<code>` at build time: its keys must be known
Trigger:
1import * as stylex from '@stylexjs/stylex';
2export function example(key) {
3 const result = stylex.create({ [key]: {} });
4 return result;
5}
1import * as stylex from '@stylexjs/stylex';
2export function example(key) {
3 const result = stylex.create({ [key]: {} });
4 return result;
5}
Why: The object-key reader accepts static identifiers and literal keys. A key computed from a runtime input has no statically extractable CSS property, namespace, condition or variable name.
Fix: Use an explicit literal key (or a constant expression that the evaluator actually resolves).
1import * as stylex from '@stylexjs/stylex'
2export function example() {
3 const result = stylex.create({ base: { color: 'red' } })
4 return result
5}
1import * as stylex from '@stylexjs/stylex'
2export function example() {
3 const result = stylex.create({ base: { color: 'red' } })
4 return result
5}
defineVars(): object spread
API: StyleX. Message pattern:
1`stylex.defineVars()` cannot use `<code>` at build time: write every entry out, as its keys must be known1`stylex.defineVars()` cannot use `<code>` at build time: write every entry out, as its keys must be known
Trigger:
1import * as stylex from '@stylexjs/stylex';
2export function example(extra) {
3 const result = stylex.defineVars({ ...extra });
4 return result;
5}
1import * as stylex from '@stylexjs/stylex';
2export function example(extra) {
3 const result = stylex.defineVars({ ...extra });
4 return result;
5}
Why: This StyleX object layer does not accept unresolved object spreads: the build needs each key. The sole namespace-level exception is a recognized ...include(styles.base) reference to an earlier local create namespace.
Fix: Write the entries explicitly; for namespace composition, spread include() with an earlier same-file namespace.
1import * as stylex from '@stylexjs/stylex'
2export function example() {
3 const result = stylex.defineVars({ color: 'red' })
4 return result
5}
1import * as stylex from '@stylexjs/stylex'
2export function example() {
3 const result = stylex.defineVars({ color: 'red' })
4 return result
5}
defineVars(): computed key
API: StyleX. Message pattern:
1`stylex.defineVars()` cannot use `<code>` at build time: its keys must be known1`stylex.defineVars()` cannot use `<code>` at build time: its keys must be known
Trigger:
1import * as stylex from '@stylexjs/stylex';
2export function example(key) {
3 const result = stylex.defineVars({ [key]: 'red' });
4 return result;
5}
1import * as stylex from '@stylexjs/stylex';
2export function example(key) {
3 const result = stylex.defineVars({ [key]: 'red' });
4 return result;
5}
Why: The object-key reader accepts static identifiers and literal keys. A key computed from a runtime input has no statically extractable CSS property, namespace, condition or variable name.
Fix: Use an explicit literal key (or a constant expression that the evaluator actually resolves).
1import * as stylex from '@stylexjs/stylex'
2export function example() {
3 const result = stylex.defineVars({ color: 'red' })
4 return result
5}
1import * as stylex from '@stylexjs/stylex'
2export function example() {
3 const result = stylex.defineVars({ color: 'red' })
4 return result
5}
defineConsts(): object spread
API: StyleX. Message pattern:
1`stylex.defineConsts()` cannot use `<code>` at build time: write every entry out, as its keys must be known1`stylex.defineConsts()` cannot use `<code>` at build time: write every entry out, as its keys must be known
Trigger:
1import * as stylex from '@stylexjs/stylex';
2export function example(extra) {
3 const result = stylex.defineConsts({ ...extra });
4 return result;
5}
1import * as stylex from '@stylexjs/stylex';
2export function example(extra) {
3 const result = stylex.defineConsts({ ...extra });
4 return result;
5}
Why: This StyleX object layer does not accept unresolved object spreads: the build needs each key. The sole namespace-level exception is a recognized ...include(styles.base) reference to an earlier local create namespace.
Fix: Write the entries explicitly; for namespace composition, spread include() with an earlier same-file namespace.
1import * as stylex from '@stylexjs/stylex'
2export function example() {
3 const result = stylex.defineConsts({ color: 'red' })
4 return result
5}
1import * as stylex from '@stylexjs/stylex'
2export function example() {
3 const result = stylex.defineConsts({ color: 'red' })
4 return result
5}
defineConsts(): computed key
API: StyleX. Message pattern:
1`stylex.defineConsts()` cannot use `<code>` at build time: its keys must be known1`stylex.defineConsts()` cannot use `<code>` at build time: its keys must be known
Trigger:
1import * as stylex from '@stylexjs/stylex';
2export function example(key) {
3 const result = stylex.defineConsts({ [key]: 'red' });
4 return result;
5}
1import * as stylex from '@stylexjs/stylex';
2export function example(key) {
3 const result = stylex.defineConsts({ [key]: 'red' });
4 return result;
5}
Why: The object-key reader accepts static identifiers and literal keys. A key computed from a runtime input has no statically extractable CSS property, namespace, condition or variable name.
Fix: Use an explicit literal key (or a constant expression that the evaluator actually resolves).
1import * as stylex from '@stylexjs/stylex'
2export function example() {
3 const result = stylex.defineConsts({ color: 'red' })
4 return result
5}
1import * as stylex from '@stylexjs/stylex'
2export function example() {
3 const result = stylex.defineConsts({ color: 'red' })
4 return result
5}
createThemeContract(): object spread
API: StyleX. Message pattern:
1`stylex.createThemeContract()` cannot use `<code>` at build time: write every entry out, as its keys must be known1`stylex.createThemeContract()` cannot use `<code>` at build time: write every entry out, as its keys must be known
Trigger:
1import * as stylex from '@stylexjs/stylex';
2export function example(extra) {
3 const result = stylex.createThemeContract({ ...extra });
4 return result;
5}
1import * as stylex from '@stylexjs/stylex';
2export function example(extra) {
3 const result = stylex.createThemeContract({ ...extra });
4 return result;
5}
Why: This StyleX object layer does not accept unresolved object spreads: the build needs each key. The sole namespace-level exception is a recognized ...include(styles.base) reference to an earlier local create namespace.
Fix: Write the entries explicitly; for namespace composition, spread include() with an earlier same-file namespace.
1import * as stylex from '@stylexjs/stylex'
2export function example() {
3 const result = stylex.createThemeContract({ color: 'red' })
4 return result
5}
1import * as stylex from '@stylexjs/stylex'
2export function example() {
3 const result = stylex.createThemeContract({ color: 'red' })
4 return result
5}
createThemeContract(): computed key
API: StyleX. Message pattern:
1`stylex.createThemeContract()` cannot use `<code>` at build time: its keys must be known1`stylex.createThemeContract()` cannot use `<code>` at build time: its keys must be known
Trigger:
1import * as stylex from '@stylexjs/stylex';
2export function example(key) {
3 const result = stylex.createThemeContract({ [key]: 'red' });
4 return result;
5}
1import * as stylex from '@stylexjs/stylex';
2export function example(key) {
3 const result = stylex.createThemeContract({ [key]: 'red' });
4 return result;
5}
Why: The object-key reader accepts static identifiers and literal keys. A key computed from a runtime input has no statically extractable CSS property, namespace, condition or variable name.
Fix: Use an explicit literal key (or a constant expression that the evaluator actually resolves).
1import * as stylex from '@stylexjs/stylex'
2export function example() {
3 const result = stylex.createThemeContract({ color: 'red' })
4 return result
5}
1import * as stylex from '@stylexjs/stylex'
2export function example() {
3 const result = stylex.createThemeContract({ color: 'red' })
4 return result
5}
positionTry(): object spread
API: StyleX. Message pattern:
1`stylex.positionTry()` cannot use `<code>` at build time: write every entry out, as its keys must be known1`stylex.positionTry()` cannot use `<code>` at build time: write every entry out, as its keys must be known
Trigger:
1import * as stylex from '@stylexjs/stylex';
2export function example(extra) {
3 const result = stylex.positionTry({ ...extra });
4 return result;
5}
1import * as stylex from '@stylexjs/stylex';
2export function example(extra) {
3 const result = stylex.positionTry({ ...extra });
4 return result;
5}
Why: This StyleX object layer does not accept unresolved object spreads: the build needs each key. The sole namespace-level exception is a recognized ...include(styles.base) reference to an earlier local create namespace.
Fix: Write the entries explicitly; for namespace composition, spread include() with an earlier same-file namespace.
1import * as stylex from '@stylexjs/stylex'
2export function example() {
3 const result = stylex.positionTry({ color: 'red' })
4 return result
5}
1import * as stylex from '@stylexjs/stylex'
2export function example() {
3 const result = stylex.positionTry({ color: 'red' })
4 return result
5}
positionTry(): computed key
API: StyleX. Message pattern:
1`stylex.positionTry()` cannot use `<code>` at build time: its keys must be known1`stylex.positionTry()` cannot use `<code>` at build time: its keys must be known
Trigger:
1import * as stylex from '@stylexjs/stylex';
2export function example(key) {
3 const result = stylex.positionTry({ [key]: 'red' });
4 return result;
5}
1import * as stylex from '@stylexjs/stylex';
2export function example(key) {
3 const result = stylex.positionTry({ [key]: 'red' });
4 return result;
5}
Why: The object-key reader accepts static identifiers and literal keys. A key computed from a runtime input has no statically extractable CSS property, namespace, condition or variable name.
Fix: Use an explicit literal key (or a constant expression that the evaluator actually resolves).
1import * as stylex from '@stylexjs/stylex'
2export function example() {
3 const result = stylex.positionTry({ color: 'red' })
4 return result
5}
1import * as stylex from '@stylexjs/stylex'
2export function example() {
3 const result = stylex.positionTry({ color: 'red' })
4 return result
5}
viewTransitionClass(): object spread
API: StyleX. Message pattern:
1`stylex.viewTransitionClass()` cannot use `<code>` at build time: write every entry out, as its keys must be known1`stylex.viewTransitionClass()` cannot use `<code>` at build time: write every entry out, as its keys must be known
Trigger:
1import * as stylex from '@stylexjs/stylex';
2export function example(extra) {
3 const result = stylex.viewTransitionClass({ ...extra });
4 return result;
5}
1import * as stylex from '@stylexjs/stylex';
2export function example(extra) {
3 const result = stylex.viewTransitionClass({ ...extra });
4 return result;
5}
Why: This StyleX object layer does not accept unresolved object spreads: the build needs each key. The sole namespace-level exception is a recognized ...include(styles.base) reference to an earlier local create namespace.
Fix: Write the entries explicitly; for namespace composition, spread include() with an earlier same-file namespace.
1import * as stylex from '@stylexjs/stylex'
2export function example() {
3 const result = stylex.viewTransitionClass({ old: { opacity: 0 } })
4 return result
5}
1import * as stylex from '@stylexjs/stylex'
2export function example() {
3 const result = stylex.viewTransitionClass({ old: { opacity: 0 } })
4 return result
5}
viewTransitionClass(): computed key
API: StyleX. Message pattern:
1`stylex.viewTransitionClass()` cannot use `<code>` at build time: its keys must be known1`stylex.viewTransitionClass()` cannot use `<code>` at build time: its keys must be known
Trigger:
1import * as stylex from '@stylexjs/stylex';
2export function example(key) {
3 const result = stylex.viewTransitionClass({ [key]: 'red' });
4 return result;
5}
1import * as stylex from '@stylexjs/stylex';
2export function example(key) {
3 const result = stylex.viewTransitionClass({ [key]: 'red' });
4 return result;
5}
Why: The object-key reader accepts static identifiers and literal keys. A key computed from a runtime input has no statically extractable CSS property, namespace, condition or variable name.
Fix: Use an explicit literal key (or a constant expression that the evaluator actually resolves).
1import * as stylex from '@stylexjs/stylex'
2export function example() {
3 const result = stylex.viewTransitionClass({ old: { opacity: 0 } })
4 return result
5}
1import * as stylex from '@stylexjs/stylex'
2export function example() {
3 const result = stylex.viewTransitionClass({ old: { opacity: 0 } })
4 return result
5}
createTheme(): override spread
API: StyleX. Message pattern:
1`stylex.createTheme()` cannot use `<code>` at build time: write every entry out, as its keys must be known1`stylex.createTheme()` cannot use `<code>` at build time: write every entry out, as its keys must be known
Trigger:
1import * as stylex from '@stylexjs/stylex';
2const vars = stylex.defineVars({ color: 'red' });
3export function example(extra) {
4 const result = stylex.createTheme(vars, { ...extra });
5 return result;
6}
1import * as stylex from '@stylexjs/stylex';
2const vars = stylex.defineVars({ color: 'red' });
3export function example(extra) {
4 const result = stylex.createTheme(vars, { ...extra });
5 return result;
6}
Why: This StyleX object layer does not accept unresolved object spreads: the build needs each key. The sole namespace-level exception is a recognized ...include(styles.base) reference to an earlier local create namespace.
Fix: Write the entries explicitly; for namespace composition, spread include() with an earlier same-file namespace.
1import * as stylex from '@stylexjs/stylex'
2const vars = stylex.defineVars({ color: 'red' })
3export function example() {
4 const result = stylex.createTheme(vars, { color: 'blue' })
5 return result
6}
1import * as stylex from '@stylexjs/stylex'
2const vars = stylex.defineVars({ color: 'red' })
3export function example() {
4 const result = stylex.createTheme(vars, { color: 'blue' })
5 return result
6}
createTheme(): computed override key
API: StyleX. Message pattern:
1`stylex.createTheme()` cannot use `<code>` at build time: its keys must be known1`stylex.createTheme()` cannot use `<code>` at build time: its keys must be known
Trigger:
1import * as stylex from '@stylexjs/stylex';
2const vars = stylex.defineVars({ color: 'red' });
3export function example(key) {
4 const result = stylex.createTheme(vars, { [key]: 'blue' });
5 return result;
6}
1import * as stylex from '@stylexjs/stylex';
2const vars = stylex.defineVars({ color: 'red' });
3export function example(key) {
4 const result = stylex.createTheme(vars, { [key]: 'blue' });
5 return result;
6}
Why: The object-key reader accepts static identifiers and literal keys. A key computed from a runtime input has no statically extractable CSS property, namespace, condition or variable name.
Fix: Use an explicit literal key (or a constant expression that the evaluator actually resolves).
1import * as stylex from '@stylexjs/stylex'
2const vars = stylex.defineVars({ color: 'red' })
3export function example() {
4 const result = stylex.createTheme(vars, { color: 'blue' })
5 return result
6}
1import * as stylex from '@stylexjs/stylex'
2const vars = stylex.defineVars({ color: 'red' })
3export function example() {
4 const result = stylex.createTheme(vars, { color: 'blue' })
5 return result
6}
include(): malformed bare reference
API: StyleX. Message pattern:
1`stylex.include()` cannot use `<code>` at build time: it takes a namespace such as `styles.base`1`stylex.include()` cannot use `<code>` at build time: it takes a namespace such as `styles.base`
Trigger:
1import * as stylex from '@stylexjs/stylex';
2const styles = stylex.create({ base: { color: 'red' } });
3export function example() {
4 const result = stylex.create({ derived: { ...stylex.include(styles) } });
5 return result;
6}
1import * as stylex from '@stylexjs/stylex';
2const styles = stylex.create({ base: { color: 'red' } });
3export function example() {
4 const result = stylex.create({ derived: { ...stylex.include(styles) } });
5 return result;
6}
Why: A recognized include spread reads one static member on an identifier, such as styles.base. A bare identifier, nested member path, computed member or missing argument does not have that shape.
Fix: Declare a local create() map and spread stylex.include(styles.base) inside a static namespace.
1import * as stylex from '@stylexjs/stylex'
2const styles = stylex.create({ base: { color: 'red' } })
3export function example() {
4 const result = stylex.create({ derived: { ...stylex.include(styles.base) } })
5 return result
6}
1import * as stylex from '@stylexjs/stylex'
2const styles = stylex.create({ base: { color: 'red' } })
3export function example() {
4 const result = stylex.create({ derived: { ...stylex.include(styles.base) } })
5 return result
6}
include(): namespace not defined earlier
API: StyleX. Message pattern:
1`stylex.include()` cannot use `<code>` at build time: it takes a namespace `stylex.create()` defines earlier in this file1`stylex.include()` cannot use `<code>` at build time: it takes a namespace `stylex.create()` defines earlier in this file
Trigger:
1import * as stylex from '@stylexjs/stylex'; 2const styles = stylex.create({ base: { color: 'red' } }); 3export const more = stylex.create({ derived: { ...stylex.include(styles.missing) } });1import * as stylex from '@stylexjs/stylex'; 2const styles = stylex.create({ base: { color: 'red' } }); 3export const more = stylex.create({ derived: { ...stylex.include(styles.missing) } });
Why: Having the syntax styles.base is insufficient: the visible binding and member must have been registered by an earlier create() in this file. Unknown, imported, parameter or missing namespace references cannot be composed here. A create() that includes the namespace it is itself defining reads that const before it is initialized, which is reported as such.
Fix: Define the namespace earlier in this file and reference an existing member from that binding.
1import * as stylex from '@stylexjs/stylex'
2const styles = stylex.create({ base: { color: 'red' } })
3export function example() {
4 const result = stylex.create({ derived: { ...stylex.include(styles.base) } })
5 return result
6}
1import * as stylex from '@stylexjs/stylex'
2const styles = stylex.create({ base: { color: 'red' } })
3export function example() {
4 const result = stylex.create({ derived: { ...stylex.include(styles.base) } })
5 return result
6}
defineVars(): runtime variable value
API: StyleX. Message pattern:
1`stylex.defineVars()` cannot use `<code>` at build time: its values must be literals, theme tokens or constants, or be computed from them1`stylex.defineVars()` cannot use `<code>` at build time: its values must be literals, theme tokens or constants, or be computed from them
Trigger:
1import * as stylex from '@stylexjs/stylex';
2export function example(value) {
3 const result = stylex.defineVars({ color: value });
4 return result;
5}
1import * as stylex from '@stylexjs/stylex';
2export function example(value) {
3 const result = stylex.defineVars({ color: value });
4 return result;
5}
Why: defineVars/createTheme variable values are literal leaves or nested default/@media/@supports/@container condition objects, optionally wrapped by types.*(). Null contributes no assignment. Runtime leaves, arrays and pseudo conditions are not variable values.
Fix: Use a literal variable value, or a supported default/at-rule condition object with static leaves.
1import * as stylex from '@stylexjs/stylex'
2export function example() {
3 const result = stylex.defineVars({ color: 'red' })
4 return result
5}
1import * as stylex from '@stylexjs/stylex'
2export function example() {
3 const result = stylex.defineVars({ color: 'red' })
4 return result
5}
createTheme(): runtime variable value
API: StyleX. Message pattern:
1`stylex.createTheme()` cannot use `<code>` at build time: its values must be literals, theme tokens or constants, or be computed from them1`stylex.createTheme()` cannot use `<code>` at build time: its values must be literals, theme tokens or constants, or be computed from them
Trigger:
1import * as stylex from '@stylexjs/stylex';
2const vars = stylex.defineVars({ color: 'red' });
3export function example(value) {
4 const result = stylex.createTheme(vars, { color: value });
5 return result;
6}
1import * as stylex from '@stylexjs/stylex';
2const vars = stylex.defineVars({ color: 'red' });
3export function example(value) {
4 const result = stylex.createTheme(vars, { color: value });
5 return result;
6}
Why: defineVars/createTheme variable values are literal leaves or nested default/@media/@supports/@container condition objects, optionally wrapped by types.*(). Null contributes no assignment. Runtime leaves, arrays and pseudo conditions are not variable values.
Fix: Use a literal variable value, or a supported default/at-rule condition object with static leaves.
1import * as stylex from '@stylexjs/stylex'
2const vars = stylex.defineVars({ color: 'red' })
3export function example() {
4 const result = stylex.createTheme(vars, { color: 'blue' })
5 return result
6}
1import * as stylex from '@stylexjs/stylex'
2const vars = stylex.defineVars({ color: 'red' })
3export function example() {
4 const result = stylex.createTheme(vars, { color: 'blue' })
5 return result
6}
Override only keys present in the theme contract
API: StyleX. Message pattern:
1`stylex.createTheme()` cannot use `<code>` at build time: `vars` has no such variable1`stylex.createTheme()` cannot use `<code>` at build time: `vars` has no such variable
Trigger:
1import * as stylex from '@stylexjs/stylex';
2const vars = stylex.defineVars({ color: 'red' });
3export function example() {
4 const result = stylex.createTheme(vars, { missing: 'blue' });
5 return result;
6}
1import * as stylex from '@stylexjs/stylex';
2const vars = stylex.defineVars({ color: 'red' });
3export function example() {
4 const result = stylex.createTheme(vars, { missing: 'blue' });
5 return result;
6}
Why: createTheme maps override keys to custom properties registered by its contract. A key absent from that contract has no CSS variable to assign.
Fix: Use an existing contract key or add the intended key to the contract declaration first.
1import * as stylex from '@stylexjs/stylex'
2const vars = stylex.defineVars({ color: 'red' })
3export function example() {
4 const result = stylex.createTheme(vars, { color: 'blue' })
5 return result
6}
1import * as stylex from '@stylexjs/stylex'
2const vars = stylex.defineVars({ color: 'red' })
3export function example() {
4 const result = stylex.createTheme(vars, { color: 'blue' })
5 return result
6}
defineConsts(): null value is not a literal
API: StyleX. Message pattern:
1`stylex.defineConsts()` cannot use `<code>` at build time: its values must be literals, theme tokens or constants, or be computed from them1`stylex.defineConsts()` cannot use `<code>` at build time: its values must be literals, theme tokens or constants, or be computed from them
Trigger:
1import * as stylex from '@stylexjs/stylex';
2export function example() {
3 const result = stylex.defineConsts({ color: null });
4 return result;
5}
1import * as stylex from '@stylexjs/stylex';
2export function example() {
3 const result = stylex.defineConsts({ color: null });
4 return result;
5}
Why: defineConsts uses the literal reader directly: it neither reads condition objects nor unwraps StyleX helper calls, and null is not a literal value that this reader publishes.
Fix: Replace the value with a literal such as red.
1import * as stylex from '@stylexjs/stylex'
2export function example() {
3 const result = stylex.defineConsts({ color: 'red' })
4 return result
5}
1import * as stylex from '@stylexjs/stylex'
2export function example() {
3 const result = stylex.defineConsts({ color: 'red' })
4 return result
5}
positionTry(): null declaration value
API: StyleX. Message pattern:
1`stylex.positionTry()` cannot use `<code>` at build time: its values must be literals, theme tokens or constants, or be computed from them1`stylex.positionTry()` cannot use `<code>` at build time: its values must be literals, theme tokens or constants, or be computed from them
Trigger:
1import * as stylex from '@stylexjs/stylex';
2export function example() {
3 const result = stylex.positionTry({ color: null });
4 return result;
5}
1import * as stylex from '@stylexjs/stylex';
2export function example() {
3 const result = stylex.positionTry({ color: null });
4 return result;
5}
Why: This named declaration-block API accepts literal CSS values, not runtime leaves, null, arrays or value-level condition objects. Its declaration reader normalizes property names and numeric units without dynamic variables.
Fix: Supply a static literal CSS value for the declaration.
1import * as stylex from '@stylexjs/stylex'
2export function example() {
3 const result = stylex.positionTry({ color: 'red' })
4 return result
5}
1import * as stylex from '@stylexjs/stylex'
2export function example() {
3 const result = stylex.positionTry({ color: 'red' })
4 return result
5}
positionTry(): types is outside its enclosing API context
API: StyleX. Message pattern:
1`stylex.positionTry()` cannot use `<code>` at build time: its values must be literals; `firstThatWorks()`, `include()` and `types` are read only inside `stylex.create()` and `stylex.defineVars()`1`stylex.positionTry()` cannot use `<code>` at build time: its values must be literals; `firstThatWorks()`, `include()` and `types` are read only inside `stylex.create()` and `stylex.defineVars()`
Trigger:
1import * as stylex from '@stylexjs/stylex';
2export function example() {
3 const result = stylex.positionTry({ color: stylex.types.color('red') });
4 return result;
5}
1import * as stylex from '@stylexjs/stylex';
2export function example() {
3 const result = stylex.positionTry({ color: stylex.types.color('red') });
4 return result;
5}
Why: The declaration reader recognizes genuine StyleX helper calls but does not read them here. Its dedicated error explains that values are literals and helpers are read only by create()/defineVars(); each helper still has its own supported subcontext there.
Fix: Replace the helper with a literal here. Use firstThatWorks in a static create property, include as a static namespace spread, and types as a supported value wrapper.
1import * as stylex from '@stylexjs/stylex'
2export function example() {
3 const result = stylex.positionTry({ color: 'red' })
4 return result
5}
1import * as stylex from '@stylexjs/stylex'
2export function example() {
3 const result = stylex.positionTry({ color: 'red' })
4 return result
5}
viewTransitionClass(): null declaration value
API: StyleX. Message pattern:
1`stylex.viewTransitionClass()` cannot use `<code>` at build time: its values must be literals, theme tokens or constants, or be computed from them1`stylex.viewTransitionClass()` cannot use `<code>` at build time: its values must be literals, theme tokens or constants, or be computed from them
Trigger:
1import * as stylex from '@stylexjs/stylex';
2export function example() {
3 const result = stylex.viewTransitionClass({ old: { color: null } });
4 return result;
5}
1import * as stylex from '@stylexjs/stylex';
2export function example() {
3 const result = stylex.viewTransitionClass({ old: { color: null } });
4 return result;
5}
Why: This named declaration-block API accepts literal CSS values, not runtime leaves, null, arrays or value-level condition objects. Its declaration reader normalizes property names and numeric units without dynamic variables.
Fix: Supply a static literal CSS value for the declaration.
1import * as stylex from '@stylexjs/stylex'
2export function example() {
3 const result = stylex.viewTransitionClass({ old: { opacity: 0 } })
4 return result
5}
1import * as stylex from '@stylexjs/stylex'
2export function example() {
3 const result = stylex.viewTransitionClass({ old: { opacity: 0 } })
4 return result
5}
viewTransitionClass(): types is outside its enclosing API context
API: StyleX. Message pattern:
1`stylex.viewTransitionClass()` cannot use `<code>` at build time: its values must be literals; `firstThatWorks()`, `include()` and `types` are read only inside `stylex.create()` and `stylex.defineVars()`1`stylex.viewTransitionClass()` cannot use `<code>` at build time: its values must be literals; `firstThatWorks()`, `include()` and `types` are read only inside `stylex.create()` and `stylex.defineVars()`
Trigger:
1import * as stylex from '@stylexjs/stylex';
2export function example() {
3 const result = stylex.viewTransitionClass({ old: { color: stylex.types.color('red') } });
4 return result;
5}
1import * as stylex from '@stylexjs/stylex';
2export function example() {
3 const result = stylex.viewTransitionClass({ old: { color: stylex.types.color('red') } });
4 return result;
5}
Why: The declaration reader recognizes genuine StyleX helper calls but does not read them here. Its dedicated error explains that values are literals and helpers are read only by create()/defineVars(); each helper still has its own supported subcontext there.
Fix: Replace the helper with a literal here. Use firstThatWorks in a static create property, include as a static namespace spread, and types as a supported value wrapper.
1import * as stylex from '@stylexjs/stylex'
2export function example() {
3 const result = stylex.viewTransitionClass({ old: { opacity: 0 } })
4 return result
5}
1import * as stylex from '@stylexjs/stylex'
2export function example() {
3 const result = stylex.viewTransitionClass({ old: { opacity: 0 } })
4 return result
5}
firstThatWorks(): null fallback value
API: StyleX. Message pattern:
1`stylex.firstThatWorks()` cannot use `<code>` at build time: its values must be literals, theme tokens or constants, or be computed from them1`stylex.firstThatWorks()` cannot use `<code>` at build time: its values must be literals, theme tokens or constants, or be computed from them
Trigger:
1import * as stylex from '@stylexjs/stylex';
2export function example() {
3 const result = stylex.create({ base: { color: stylex.firstThatWorks('red', null) } });
4 return result;
5}
1import * as stylex from '@stylexjs/stylex';
2export function example() {
3 const result = stylex.create({ base: { color: stylex.firstThatWorks('red', null) } });
4 return result;
5}
Why: firstThatWorks is read inside a static create() property and each fallback argument must independently resolve to a static leaf. A spread, null or condition object is not one fallback leaf.
Fix: Pass individual static fallback values; retain condition objects outside the fallback helper if needed.
1import * as stylex from '@stylexjs/stylex'
2export function example() {
3 const result = stylex.create({
4 base: { color: stylex.firstThatWorks('red', 'blue') },
5 })
6 return result
7}
1import * as stylex from '@stylexjs/stylex'
2export function example() {
3 const result = stylex.create({
4 base: { color: stylex.firstThatWorks('red', 'blue') },
5 })
6 return result
7}
keyframes(): frame-spread
API: StyleX. Message pattern:
1`stylex.keyframes()` cannot use `<code>` at build time: its values must be literals, theme tokens or constants, or be computed from them1`stylex.keyframes()` cannot use `<code>` at build time: its values must be literals, theme tokens or constants, or be computed from them
Trigger:
1import * as stylex from '@stylexjs/stylex';
2export function example(extra) {
3 const result = stylex.keyframes({ ...extra });
4 return result;
5}
1import * as stylex from '@stylexjs/stylex';
2export function example(extra) {
3 const result = stylex.keyframes({ ...extra });
4 return result;
5}
Why: Keyframes have no element on which to place a runtime value or conditional class. Frame keys and declarations must resolve to a fixed set of static CSS declarations; unreadable keys/spreads and runtime branches are reported through the keyframes value requirement.
Fix: Write explicit frames and CSS declarations with literal/foldable values. Move runtime selection outside the keyframes definition.
1import * as stylex from '@stylexjs/stylex'
2export function example() {
3 const result = stylex.keyframes({ from: { opacity: 0 }, to: { opacity: 1 } })
4 return result
5}
1import * as stylex from '@stylexjs/stylex'
2export function example() {
3 const result = stylex.keyframes({ from: { opacity: 0 }, to: { opacity: 1 } })
4 return result
5}
Plugins and config
These messages come from the build plugins rather than from the extractor. The plugins also forward every extractor diagnostic above as the error of the file it is in; native filesystem or transport failures depend on the platform and the underlying error.
devup.json cannot be loaded
Message patterns:
1<file> is not valid JSON: <parser message>. Fix its syntax; Devup UI does not load the theme until it parses. 2<file> must hold a JSON object such as { "theme": {} }, not <null | an array | a string | ...>. 3devup.json `extends` form a cycle: <file> -> <file> -> <file>. Remove the `extends` entry that points back to an earlier file.1<file> is not valid JSON: <parser message>. Fix its syntax; Devup UI does not load the theme until it parses. 2<file> must hold a JSON object such as { "theme": {} }, not <null | an array | a string | ...>. 3devup.json `extends` form a cycle: <file> -> <file> -> <file>. Remove the `extends` entry that points back to an earlier file.
Why: The theme is read from devup.json and every file its extends lists. Building with an empty theme instead would ship classes reading theme variables that are never declared.
Fix: Correct the file the message names. A file listed in extends that does not exist is not an error: it adds nothing.
Theme tokens the build cannot emit
Message patterns:
1theme.colors.<variant>: color token '<name>' is not a valid token name: start with a letter, a digit or '_', then use letters, digits, '-', '_' and '.' 2theme.colors.<variant>: color tokens '<a>' and '<b>' both become the CSS variable --<variable>: rename one 3theme: color token '<name>' and shadow token '<name>' both become the CSS variable --<variable>: rename one1theme.colors.<variant>: color token '<name>' is not a valid token name: start with a letter, a digit or '_', then use letters, digits, '-', '_' and '.' 2theme.colors.<variant>: color tokens '<a>' and '<b>' both become the CSS variable --<variable>: rename one 3theme: color token '<name>' and shadow token '<name>' both become the CSS variable --<variable>: rename one
length and shadow tokens report the same way, as theme.length.<variant>: length token ... and theme.shadow.<variant>: shadow token ....
Why: A token becomes a CSS variable (gray.100 is --gray-100), so a name outside those characters would emit CSS the browser drops, and two tokens giving the same variable (a-b and a.b, or a color and a shadow token both named card) would set one variable twice.
Fix: Rename one of the tokens. See Colors for the naming rules.
Production builds and development servers
A devup.json or theme error fails a production build (vite build, a webpack build without watch, rsbuild build, next build, Bun.build) with the message above. A development server keeps running, so you can fix the file while it watches it: Vite prints the error and shows it in its error overlay, while webpack, Rsbuild and Next.js with webpack report it as a compilation error ([devup-ui] <message>) until the theme loads again. Until then the theme is empty.
When the project root has no devup.json and devupFile is not set, but the working directory has one, the plugins read that file and print a warning once:
1[devup-ui] Found devup.json relative to the working directory (<cwd file>), not the project root (<root>). ...1[devup-ui] Found devup.json relative to the working directory (<cwd file>), not the project root (<root>). ...
Move devup.json into the project root, or set devupFile. See devup.json.
Next.js coordinator failures
With Turbopack, the Next.js plugin compiles files in a coordinator process it starts for the build, and its loaders send each file there. You do not configure the coordinator; these messages mean it is not running, not answering, or could not finish.
1Coordinator port file not found: <port file>. The devup-ui coordinator for this build is not running (or exited). ... 2Coordinator unreachable at 127.0.0.1:<port> (<owner>, port file <port file>): <cause>. ...1Coordinator port file not found: <port file>. The devup-ui coordinator for this build is not running (or exited). ... 2Coordinator unreachable at 127.0.0.1:<port> (<owner>, port file <port file>): <cause>. ...
The coordinator exited, or another next dev or next build replaced it. Restart the dev server or build, and do not run next dev and next build in one distDir at the same time; give each its own distDir if they must run together.
1Coordinator CSS error: <status>: [devup-ui] coordinator: <bucket or base sheet> is incomplete (<reason>); refusing to serve partial CSS. Files not extracted: <files>.1Coordinator CSS error: <status>: [devup-ui] coordinator: <bucket or base sheet> is incomplete (<reason>); refusing to serve partial CSS. Files not extracted: <files>.
A production build waited for files that were never extracted, so it fails instead of shipping a stylesheet missing their rules. This means the files the plugin expected and the files Next.js compiled differ; report it with the file list.
Coordinator error and Coordinator response missing code mean the coordinator answered a file without a result or an error message. Restart the build; report it if it persists.
A build plugin is missing
Cannot run on the runtime is a placeholder exception, not an extractor build diagnostic. It means a compile-time component or helper executed without being transformed. Configure the appropriate Devup UI build plugin and ensure the file is included in extraction. Do not fix it by adding a styling runtime.
Catch removed runtime reads with ESLint
The devup/no-runtime-read rule reports compile-time bindings read outside supported calls/renders before the build. The lint message has a final period; the extractor message does not. The same direct call is the repair in both cases.
1`<binding>` is read at runtime, where it does not exist: the build compiles it only where it is called or rendered.1`<binding>` is read at runtime, where it does not exist: the build compiles it only where it is called or rendered.
1import { css } from '@devup-ui/react'
2consume(css)
1import { css } from '@devup-ui/react'
2consume(css)
1import { css } from '@devup-ui/react' 2const card = css({ color: 'red' })1import { css } from '@devup-ui/react' 2const card = css({ color: 'red' })
Other ESLint diagnostics, alias-retention warnings, and StyleX shorthand warnings are not extractor build errors. Tailwind classes the build does not recognise are preserved; they do not produce a new finite build-error family.
Verification sources
Each failing example on this page and its repair, with its companion modules, was compiled through the extractor at main e9e5801cc: every failing example reports the message shown, and every repair compiles. The plugin messages were checked against the plugin sources at the same commit.