Skip to content

[postcss-plugin] Fix importSource object syntax not working properly#1065

Merged
necolas merged 1 commit into
facebook:mainfrom
javascripter:fix-import-sourecs-typo
May 17, 2025
Merged

[postcss-plugin] Fix importSource object syntax not working properly#1065
necolas merged 1 commit into
facebook:mainfrom
javascripter:fix-import-sourecs-typo

Conversation

@javascripter

@javascripter javascripter commented May 17, 2025

Copy link
Copy Markdown
Contributor

What changed / motivation ?

Using the { from, as } object form in importSources caused a runtime error due to incorrect .includes usage in Previous PR. This fix ensures both string and object forms are handled properly in shouldTransform.

Linked PR/Issues

#1063

Additional Context

In main branch, move to the example app

cd examples/example-nextjs

Using the object syntax throws when running npm run example:dev:

   importSources: [
        {
          // Note:Just enough config to reproduce the error, not actually a proper config for stylex
          from: '@stylexjs/stylex',
          as: 'create',
        },
      ],

Switch to this branch and now it does not throw and renders correctly.

Pre-flight checklist

@facebook-github-bot facebook-github-bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label May 17, 2025

@necolas necolas left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We need unit tests for this plugin

@necolas necolas merged commit 77660b9 into facebook:main May 17, 2025
7 of 9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants