react-dev-inspector icon indicating copy to clipboard operation
react-dev-inspector copied to clipboard

An example about use in some frameworks like blitz.js

Open zongzheng123 opened this issue 2 years ago • 3 comments

Thanks for review. In some frameworks like blitz.js,there are a intermediate state for compilation, so the process.cwd() in middleware function "launchEditorMiddleware" will get the error base workplace, so perhaps can provide some options for user customizing their config. Of course, you can have a trick like this

const fixLaunchEditorMiddleware = (req, res, next) => { const cwd = process.cwd process.cwd = () => path.resolve(cwd(), "../../") launchEditorMiddleware(req, res, next) process.cwd = cwd }

zongzheng123 avatar Apr 29 '22 12:04 zongzheng123

@zongzheng123 may see docs of #inspector-component-props

your code could like

<Inspector
  disableLaunchEditor={true}
  onClickElement={(params: InspectParams) => customLocateBlitz(params)}
>

zthxxx avatar May 01 '22 07:05 zthxxx

what you mean is change context by mutating InspectParams, right?

zongzheng123 avatar May 01 '22 07:05 zongzheng123

~~via get relativePath of file,you can do anything yourself~~

zthxxx avatar May 01 '22 07:05 zthxxx

It's add in dev branch as beta, and you can access it by: https://stackblitz.com/github/zthxxx/react-dev-inspector/tree/dev/?file=examples/vite4/package.json

zthxxx avatar Jul 12 '23 15:07 zthxxx