Skip to content

Conversation

@henryqdineen
Copy link
Contributor

@henryqdineen henryqdineen commented Nov 20, 2025

What changed / motivation ?

I have an extremely basic chrome extension locally where I want to show the styles for an element and link to the "Sources" tab.

Screenshot 2025-11-20 at 4 03 21 PM

The problem I ran into was that filenames in data-style-src do not have enough information for me to make a chrome.devtools.panels.openResource() call when the link is clicked.

My solution in this PR is to add debugFilePath option that we can use to customize the filenames used in data-style-src. In our case the debugFilePath implementation will be very similar to our logic in the our Rspack output.devtoolModuleFilenameTemplate config, which determines the filenames in the source map.

We don't have an immediate need for this feature but I figured it was worth creating a PR to open the discussion. We are interested in any future devtools and out want to make sure they work for us. Thanks!

Pre-flight checklist

@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 Nov 20, 2025
@henryqdineen henryqdineen changed the title [babel-plugin] add createShortFilename option for custom module resol… [babel-plugin] add createShortFilename option for unstable_moduleResolution Nov 20, 2025
@mellyeliu
Copy link
Member

Awesome! Just needs flow fixes. We have it in the backlog to create a more comprehensive dev tools extension.

@nmn
Copy link
Collaborator

nmn commented Nov 21, 2025

One change I would suggest is to not nest the config option under unstable_moduleResolution.

That is very specific to theming APIs and this work is more general than that, so it probably makes sense to make it a top-level config option.

@henryqdineen henryqdineen changed the title [babel-plugin] add createShortFilename option for unstable_moduleResolution [babel-plugin] add createShortFilename option Nov 24, 2025
@henryqdineen
Copy link
Contributor Author

henryqdineen commented Nov 24, 2025

Sorry for the delay. I just pushed a commit that fixes the flow types and moves createShortFilename to be a top-level config option. Let me know if there is a more appropriate name for the option. debugFilePath?

@nmn
Copy link
Collaborator

nmn commented Nov 26, 2025

Let's rename the option to debugFilePath and please rebase this PR.

Copy link
Collaborator

@nmn nmn left a comment

Choose a reason for hiding this comment

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

The changes themselves look good. Should be good to merge after a rebase and change the name of the config option.

@henryqdineen henryqdineen changed the title [babel-plugin] add createShortFilename option [babel-plugin] add debugFilePath option Nov 26, 2025
@henryqdineen
Copy link
Contributor Author

Rebased, renamed, and updated PR subject/body. Thanks!

@mellyeliu mellyeliu merged commit 5435f17 into facebook:main Nov 26, 2025
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.

3 participants