lilnasy / gratelets

A collection of purpose-built, small, third-party integrations for Astro.
The Unlicense
105 stars 6 forks source link

Importing tokens with defineVars with Astro and the styleX integration doesn't seem to work. #44

Closed madebyjonny closed 10 months ago

madebyjonny commented 10 months ago

The Problem

When trying to import the vars from a file that is defining the tokens (using a .stylex.ts file) seems to break things, I get the error of Only static values are allowed inside of a stylex.create() call.

Steps to reproduce

  1. Install the StyleX Astro integration
  2. Follow steps to configure it
  3. Create a vars.stylex.ts file, with a named export for defineVars
  4. Try to import it and use it inside of stylex.create

This should throw the error mentioned.

Enviroment Node v20.5.1 (I have no tried on any other versions). NextJS 14.0.1 (this is the only version I have tried).

lilnasy commented 10 months ago

Thanks for reporting! I would've thought it works out of the box but apparently it needs a configuration option to be set. I can release the fix today.