zthxxx / react-dev-inspector

jump to local IDE code directly from browser React component by just a simple click
https://react-dev-inspector.zthxxx.me
MIT License
1.13k stars 67 forks source link

simplify nextjs integratation #168

Open tjx666 opened 1 month ago

tjx666 commented 1 month ago

project next-devtools use react-dev-inspect internal. But it can integrate to next project more easily:

// next.config.js
const { withNextDevtools } = require('@next-devtools/core/plugin')

module.exports = withNextDevtools({
  // Other Next.js configuration ...
})

看了下那个插件的源码,那个插件貌似是启了另外一个本地 server,那样的化确实简单些,但是需要额外的 server。目前的配置方式主要的不方便的地方是要从脚本启动,没法直接 next dev。不知道有没有办法直接通过修改 next.config.js 定义 next 中间件。

zthxxx commented 1 month ago

想要达到什么样的配置写法呢? 也是形如 withNextDevtools() 这样包裹一层么

tjx666 commented 1 month ago

@zthxxx 是的,那样最理想了,目前的方式只能通过脚本启动

zthxxx commented 1 month ago

Got it! 我抽空去实现下

tjx666 commented 1 month ago

目前用脚本启动最大的不方便点就是:不能使用 next 的一些需要使用 next cli + 命令行参数才能开启的能力,例如 turbopack 和 https