Skip to content
Discussion options

You must be logged in to vote

This specific error is happening because the compiler is not configured correctly. I cannot help further without know the details of how your project is set up. You should be able to use the NextJS example in the repo as a template to get started.

But also, the code you have written won't work anyway. It's using very dynamic patterns that don't work with a compile-time approach.


You cannot do this:

const styles = stylex.create({
  button: (theme, variant, color, state = 'normal') => ({
    ...getButtonStyles(theme, variant, color, state)
  }),
});

StyleX is a compiler. stylex.create calls are compiled away. This means the styles within the stylex.create call must be statically analysable…

Replies: 2 comments 12 replies

Comment options

You must be logged in to vote
6 replies
@nmn
Comment options

nmn Dec 12, 2023
Collaborator

@Tushant
Comment options

@nmn
Comment options

nmn Dec 13, 2023
Collaborator

@stellaryrock
Comment options

@nexoracontrol-ops
Comment options

Answer selected by Tushant
Comment options

You must be logged in to vote
6 replies
@yug-delemont
Comment options

@nmn
Comment options

nmn Jan 30, 2024
Collaborator

@yug-delemont
Comment options

@nmn
Comment options

nmn Feb 1, 2024
Collaborator

@yug-delemont
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
5 participants