HorusGoul / vite-plugin-stylex

Vite Plugin for StyleX
MIT License
119 stars 13 forks source link

fix #78 rule is not iterable error #79

Closed lecstor closed 4 months ago

lecstor commented 4 months ago

Remove undefined values from rules array before passing to stylex babel plugin.

Logging rules just before stylexBabelPlugin.processStylexRules is called shows it has many undefined values in the array, which it does not have in the initial run when starting the devserver.

Filtering out the undefined values appears to resolve the issue.

Unfortunately I can't say how to replicate this issue, though I do know my this past message that I'm not the only one to see it.. https://github.com/HorusGoul/vite-plugin-stylex/issues/24#issuecomment-1870977440

{
  rules: [
    undefined,
    undefined,
    [ 'xngnso2', [Object], 3000 ],
    [ 'x1evy7pa', [Object], 3000 ],
    [ 'x10ipcqr', [Object], 3000 ],
    undefined,
    undefined,
    undefined,
    [ 'x78zum5', [Object], 3000 ],
    [ 'xdt5ytf', [Object], 3000 ],
    [ 'x6s0dn4', [Object], 3000 ],
    [ 'xagnifm', [Object], 1200 ],
    undefined,
  ]
}
changeset-bot[bot] commented 4 months ago

🦋 Changeset detected

Latest commit: 3f167276a04d80107dffdc2d914a746101ea9e3a

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package | Name | Type | | ------------------ | ----- | | vite-plugin-stylex | Patch |

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

HorusGoul commented 4 months ago

Thanks for the contribution!