react/packages/react-devtools-extensions
Ruslan Lesiutin d7bb6039de
chore[react-devtools/extensions]: make source maps url relative (#29886)
This adds few changes:
1. We are going to ship source maps only for 2 artifacts:
`installHook.js` and `react_devtools_backend_compact.js`, because it is
only these modules that can patch console and be visible to the user via
stack traces in console. We need to ship source maps to be able to use
`ignoreList` feature in source maps, so we can actually hide these from
stack traces.

| Before | After |
|--------|--------|
| ![Screenshot 2024-06-13 at 17 44
25](https://github.com/facebook/react/assets/28902667/464e097b-a95e-47eb-967c-0579daad316b)
| ![Screenshot 2024-06-13 at 17 39
53](https://github.com/facebook/react/assets/28902667/e4afe642-d65b-4296-a2cf-26c0b925ebf2)
|
 
2. The `"sources"` field in source map will have relative urls listed,
instead of absolute with `webpack://` protocol. This will move the
sources to the `React Developer Tools` frame in `Sources` panel, instead
of `webpack://`.
 
 | Before | After |
|--------|--------|
| ![Screenshot 2024-06-13 at 17 48
24](https://github.com/facebook/react/assets/28902667/a18edad2-5b4e-4ad7-8a7a-8b389c2edf92)
| ![Screenshot 2024-06-13 at 17 49
41](https://github.com/facebook/react/assets/28902667/5db491f7-5d1d-4155-9910-16ac4384d34e)
|

> [!NOTE]  
> I still have 1 unresolved issue with shipping source maps in extension
build, and it is related to Firefox, which can't find them in the
extension bundle and returns 404, even though urls are relative and I
can actually open them via unique address like
`moz-extension://<extension-id>/build/intallHook.js.map` ¯\\\_(ツ)\_/¯
2024-06-17 11:58:19 +01:00
..
.circleci Reorganized things again into packages 2019-08-13 11:37:25 -07:00
chrome React DevTools 5.1.0 -> 5.2.0 (#29022) 2024-05-08 13:26:14 +01:00
edge React DevTools 5.1.0 -> 5.2.0 (#29022) 2024-05-08 13:26:14 +01:00
firefox React DevTools 5.1.0 -> 5.2.0 (#29022) 2024-05-08 13:26:14 +01:00
flow-typed Use declare const instead of declare var (#28599) 2024-03-22 11:20:18 -04:00
icons Optimized DevTools extension images 2021-08-02 09:32:46 -04:00
popups feat[devtools/extension]: show disclaimer when page doesnt run react and refactor react polling logic (#27373) 2023-09-20 13:30:50 +01:00
src fix[react-devtools] divided inspecting elements between inspecting do… (#29885) 2024-06-13 15:37:51 +01:00
build.js refactor: resolve browser via env variables based on build rather than user agent (#27179) 2023-08-29 10:40:02 +01:00
deploy.chrome.html Fixed a bunch of Lint issues 2019-08-13 21:59:07 -07:00
deploy.edge.html React developer tools extension for Microsoft Edge (#18041) 2020-02-18 09:40:30 -08:00
deploy.firefox.html Fixed a bunch of Lint issues 2019-08-13 21:59:07 -07:00
deploy.html make link https (#19147) 2020-06-30 12:43:52 +01:00
deploy.js Added windows powershell syntax to build scripts (#27692) 2023-11-16 11:35:43 +00:00
improveImages.mjs [DevTools] Optimize Images yarn command (part 2) (#21968) 2021-08-02 09:32:17 -04:00
main.html Fixed a bunch of Lint issues 2019-08-13 21:59:07 -07:00
package.json feat[devtools]: ship source maps for content scripts and ignore list installHook script (#28730) 2024-04-08 18:10:09 +01:00
panel.html feat[devtools/extension]: show disclaimer when page doesnt run react and refactor react polling logic (#27373) 2023-09-20 13:30:50 +01:00
README.md Include install command for devtools-extension build instructions (#25053) 2022-10-05 11:27:09 -04:00
utils.js [Codemod] Update copyright header to Meta (#25315) 2022-10-18 11:19:24 -04:00
webpack.backend.js chore[react-devtools/extensions]: make source maps url relative (#29886) 2024-06-17 11:58:19 +01:00
webpack.config.js chore[react-devtools/extensions]: make source maps url relative (#29886) 2024-06-17 11:58:19 +01:00

This is the source code for the React DevTools browser extension.

Installation

The easiest way to install this extension is as a browser add-on:

Local development

You can also build and install this extension from source.

Prerequisite steps

DevTools depends on local versions of several NPM packages1 also in this workspace. You'll need to either build or download those packages first.

1 Note that at this time, an experimental build is required because DevTools depends on the createRoot API.

To install all necessary dependencies, run the following command from the root of the repository:

yarn install

Build from source

To build dependencies from source, run the following command from the root of the repository:

yarn build-for-devtools

Download from CI

To use the latest build from CI, run the following commands starting from the root of the repository:

cd scripts/release
yarn install
./download-experimental-build.js

Build steps

Once the above packages have been built or downloaded, you can build the extension by running:

cd packages/react-devtools-extensions/

yarn build:chrome # => packages/react-devtools-extensions/chrome/build
yarn run test:chrome # Test Chrome extension

yarn build:firefox # => packages/react-devtools-extensions/firefox/build
yarn run test:firefox # Test Firefox extension

yarn build:edge # => packages/react-devtools-extensions/edge/build
yarn run test:edge # Test Edge extension