Skip to content

StyleX unplugin corrupts WASM files #1470

@s-panferov

Description

@s-panferov

Describe the issue

The problem is pretty obscure, but when I include the Stylex unplugin to my RSBuild project all of my WASM files are getting corrupted.

I narrowed it down to a missing transformInclude which forces unplugin to read all the files before we can filter some for transform. Somehow this process corrupts the WASM files (which are very large output binary files).

If I include transformInclude to the unplugin code everything seems to be working fine by preventing unplugin to read the sources of these WASM files.

transformInclude(id) { const JS_LIKE_RE = /\.[cm]?[jt]sx?(\?|$)/; return JS_LIKE_RE.test(id); }, async transform(code, id) { ... 

I can follow up with a PR to add this if this makes sense to the maintainers.

Expected behavior

WASM files should not be affected by StyleX

Steps to reproduce

Include StyleX unplugin to any Rsbuild project with WASM files

Test case

No response

Additional comments

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions