nedjulius / bun-plugin-stylex

StyleX plugin for Bun
MIT License
5 stars 0 forks source link

`defineVars` variables are not picked up #1

Open nedjulius opened 7 months ago

nedjulius commented 7 months ago

With type: haste variable names are not matching:


@layer priority1, priority2, priority3, priority4;
@layer priority1{
:root{--x1t7srzs:#e67e22;--x1s93pyq:#34495e;}
}
@layer priority2{
.x1ghz6dp{margin:0}
.x1717udv{padding:0}
}
@layer priority3{
.x6s0dn4{align-items:center}
.x1lah574{background-color:var(--x1vswi0k)}
.xm5gh2h{color:var(--x1k3o04s)}
.x78zum5{display:flex}
.xdt5ytf{flex-direction:column}
.xif65rj{font-size:14px}
.x1pvqxga{font-size:24px}
.xo1l8bm{font-weight:400}
.xk50ysn{font-weight:500}
.xl56j7k{justify-content:center}
}
@layer priority4{
.x1dr59a3{height:100vh}
}

With CommonJS resolution, the variables are not even computed.

nedjulius commented 7 months ago

found the blocking issue: https://github.com/oven-sh/bun/issues/4511

the file path resolver for stylex vars relies on require.resolve, and currently the path option is not implemented on Bun

nedjulius commented 7 months ago

I released a new version that polyfills the require.resolve method required in the StyleX babel plugin. should work as a temporary fix, will attempt to fix the issue within Bun runtime itself.