facebook / facebook/stylex

Unplugin usage doesn't tap into the standard CSS build pipeline

Open
#1,378 3 comments 1 reaction 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

Hello,
After upgrading to the unplugin setup (using Vite) I've looked into assets produced by my app and spotted one thing - the styles part produced by StyleX weren't minified. So I wondered why does it happen and looked into the implementation. It seems like the output is manually appended to already built file, by either appending to its source or writing directly with `fs` module.

If I understand correctly, that's a bit of antipattern and is discouraged by e.g. Rollup:

Image

Is it somehow possible to make it a part of standard bundle, so it's handled by minification and other parts of CSS building - e.g. down-leveling? Or was it some limitation/purposeful choice?

Or is the intended usage to handle everything via `lightningcssOptions`? That would require to mimic the pipeline from Vite over there 🤔

### Expected behavior

CSS emitted by StyleX is part of normal CSS bundling in bundlers, it's minified and processed

### Steps to reproduce

1. Use the unplugin setup
2. Build the app

### 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.