Skip to content

[unplugin] Declare externalPackages option and fix dead docs link - #1863

Merged
henryqdineen merged 2 commits into
meta:mainfrom
oddurs:fix/unplugin-external-packages-type
Oct 30, 2026
Merged

henryqdineen merged 2 commits into
meta:mainfrom
oddurs:fix/unplugin-external-packages-type

Conversation

@oddurs

@oddurs oddurs commented Sep 9, 2026 •

Copy link
Copy Markdown
Contributor

What changed / motivation ?

Two things, both from #1563.

externalPackages works but isn't on the type. unpluginFactory destructures it and passes it to discoverStylexPackages as explicitPackages (src/core.js), and unplugin.mdx documents it, but UserOptions in src/core.d.ts never declared it, and it isn't in the babel-plugin StyleXOptions that UserOptions intersects either:

error TS2353: Object literal may only specify known properties, and 'externalPackages' does not exist in type 'Partial<UserOptions>'.

Declaring it on UserOptions covers all the adapters at once, since vite, webpack, esbuild and the rest take their options from it.

The other half of the issue is the link to the babel-plugin page. ./babel-plugin.mdx turns out to be the only relative link left in the docs and the only one with an .mdx suffix; everything else is an absolute /docs/... path. Made it match.

Linked PR/Issues

Fixes #1563

Additional Context

Types and docs only, nothing changes at runtime.

I left the ## Options (shared) heading as it is, though I suspect that's what led to the issue describing externalPackages as an option shared from the babel plugin. Happy to reword it if you want.

Pre-flight checklist

@oddurs
oddurs requested review from mellyeliu and nmn as code owners September 9, 2026 19:24
Copilot AI lite review requested due to automatic review settings September 9, 2026 19:24

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Copilot wasn't able to review any files in this pull request.


💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@vercel

vercel Bot commented Sep 9, 2026

Copy link
Copy Markdown

@oddurs is attempting to deploy a commit to the Meta Open Source Team on Vercel.

A member of the Team first needs to authorize it.

@meta-cla

meta-cla Bot commented Sep 9, 2026

Copy link
Copy Markdown

Hi @oddurs!

Thank you for your pull request and welcome to our community.

Action Required

In order to merge any pull request (code, docs, etc.), we require contributors to sign our Contributor License Agreement, and we don't seem to have one on file for you.

Process

In order for us to review and merge your suggested changes, please sign at https://code.facebook.com/cla. If you are contributing on behalf of someone else (eg your employer), the individual CLA may not be sufficient and your employer may need to sign the corporate CLA.

Once the CLA is signed, our tooling will perform checks and validations. Afterwards, the pull request will be tagged with CLA signed. The tagging process may take up to 1 hour after signing. Please give it that time before contacting us about it.

If you have received this in error or have any questions, please contact us at cla@meta.com. Thanks!

core.js reads externalPackages and passes it to package discovery as
explicitPackages, and unplugin.mdx documents it, but it was never declared
on UserOptions, and it isn't part of babel-plugin's StyleXOptions either,
so passing it from TypeScript was a type error.

The same docs page linked to ./babel-plugin.mdx, the only relative link
left in the docs and the only one with an .mdx suffix. Pointed it at
/docs/api/configuration/babel-plugin like every other internal link.

Fixes meta#1563
@oddurs
oddurs force-pushed the fix/unplugin-external-packages-type branch from 496da58 to 06afc9e Compare September 9, 2026 19:30
@oddurs oddurs changed the title [unplugin] Add missing externalPackages option to UserOptions type [unplugin] Declare externalPackages option and fix dead docs link Sep 9, 2026
@meta-cla

meta-cla Bot commented Sep 9, 2026

Copy link
Copy Markdown

Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Meta Open Source project. Thanks!

@meta-cla meta-cla 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 Sep 9, 2026
@henryqdineen
henryqdineen merged commit e3e2d02 into meta:main Oct 30, 2026
1 of 2 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.

Documented prop externalPackages unavailable on type in @stylexjs/unplugin

3 participants