facebook / facebook/stylex

Documented prop `externalPackages` unavailable on type in `@stylexjs/unplugin`

Open
#1,563 0 comments 0 reactions 0 assignees View on GitHub
bug
Dominant language
JavaScript
Stars
10.3k
Forks
481
Avg merge
3d 8h
Merged PRs (30d)
13

Description

### Describe the issue

The `@stylexjs/unplugin` documentation [mentions here](https://github.com/facebook/stylex/blob/60fabd52af3b7744b6348f4b5e22a02432189662/packages/docs/content/docs/api/configuration/unplugin.mdx?plain=1#L119) that option `externalPackages` is shared from `@stylexjs/babel-plugin`. Looking at the types, this option is not supported.

Additionally, [the link](https://github.com/facebook/stylex/blob/60fabd52af3b7744b6348f4b5e22a02432189662/packages/docs/content/docs/api/configuration/unplugin.mdx?plain=1#L102) to the `@stylexjs/babel-plugin` mdx file is a broken link. The current `babel-plugin.mdx` has no mention of `externalPackages`. Perhaps it's been removed?

### Expected behavior

You can use the example `@stylexjs/unplugin` Vite example from the docs, and pass the `externalPackages` option.

For example:

```tsx
import { defineConfig } from 'vite';
import react from '@vitejs/plugin-react';
import stylex from '@stylexjs/unplugin';

export default defineConfig({
plugins: [
stylex.vite({
useCSSLayers: true,
externalPackages: ['@acme/components']
}),
react()
],
});
```

### Steps to reproduce

Use the config above in typescript, and you'll get an type error, that `externalPackages` is unavailable.

### Test case

_No response_

### Additional comments

_No response_

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.