Skip to content
GitLab
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • C create-react-app
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 1,547
    • Issues 1,547
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 417
    • Merge requests 417
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages and registries
    • Packages and registries
    • Package Registry
    • Infrastructure Registry
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • Meta
  • create-react-app
  • Merge requests
  • !10563

PoC: supoort absolute path for launchEditor

  • Review changes

  • Download
  • Email patches
  • Plain diff
Closed Administrator requested to merge github/fork/iChenLei/support-absolute-path into main Feb 16, 2021
  • Overview 1
  • Commits 1
  • Pipelines 0
  • Changes 1

Created by: iChenLei

Summary

To supoort react devtools launch editor feature https://github.com/facebook/react/pull/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.

Assignee
Assign to
Reviewers
Request review from
Time tracking
Source branch: github/fork/iChenLei/support-absolute-path