Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PoC: supoort absolute path for launchEditor #10563

Closed
wants to merge 1 commit into from
Closed

PoC: supoort absolute path for launchEditor #10563

wants to merge 1 commit into from

Conversation

iChenLei
Copy link

Summary

To supoort react devtools launch editor feature facebook/react#20821

launchEditor

Current issues

When we develop a react project in DEV, we can get the component source file path by source, (but it's abosulte path usually, react-dev-utils not support currently.)

 * @param {*} source An annotation object (added by a transpiler or otherwise)
 * indicating filename, line number, and/or other information.
 * @internal
 */
const ReactElement = function(type, key, ref, self, source, owner, props) {

for example

/Users/username/code/src/app.tsx 🙅‍♂️
/src/app.tsx 👌

support custom launchEditorEndpoint

2021-02-16 12 34 52

Do we need change these hard code for launchEditorEndpoint ???

- // TODO: we might want to make this injectable to support DEV-time non-root URLs.
- module.exports = '/__open-stack-frame-in-editor';
+ const LaunchEditorEndpoint = process.env.LAUNCH_EDITOR_ENDPOINT ?? '/__open-stack-frame-in-editor';
+ module.exports = LaunchEditorEndpoint;

So we can inject custom LaunchEditorEndpoint by node process env.

"start": "LAUNCH_EDITOR_ENDPOINT=/__open-in-editor react-scripts start"

Test Plan

Please tell me how to test this change ? necessary unit test will be added later when I figure out how to test it.

append

Welcome any suggestion. 😄 This is a draft pull request, not the final pull request.

@stale
Copy link

stale bot commented Jan 9, 2022

This pull request has been automatically marked as stale because it has not had any recent activity. It will be closed in 5 days if no further activity occurs.

@stale stale bot added the stale label Jan 9, 2022
@iChenLei iChenLei closed this Jan 9, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants