react-dev-inspector
react-dev-inspector copied to clipboard
An example about use in some frameworks like blitz.js
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 may see docs of #inspector-component-props
your code could like
<Inspector
disableLaunchEditor={true}
onClickElement={(params: InspectParams) => customLocateBlitz(params)}
>
what you mean is change context by mutating InspectParams, right?
~~via get relativePath
of file,you can do anything yourself~~
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