facebook / facebook/stylex

`data-style-src` does not respect `inputSourceMap`

Open
#1,195 3 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

Hi,

When a file that already has been preprocessed is fed to the StyleX babel plugin, the plugin emits `data-style-src` with the file and line from the already processed file.

### Expected behavior

The plugin should look a the source map and provide the file and line from the original source code in `data-style-src`, not some intermediary state.

### Steps to reproduce

Create a file using StyleX and something requiring rewrite of the source code, such as react.

Process the JSX using babel, get a source map out of it.

Call babel a second time, this time to process StyleX, pass the source map generated in the first call as inputSourceMap when calling babel's transformAsync.

Source and line number emitted for `data-style-src` correspond to the one in the intermediate state of the file, not it's original state.

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