infi-pc / locatorjs

Home Page:https://www.locatorjs.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

bug: Not working in NextJs 14.2.2

timscullin opened this issue · comments

Where the bug happens

  • Browser Extension
  • Library
  • Other

your browser

No response

Describe the bug

I just upgraded to 14.2.2 from 14.1.4 and locatorJs stopped working.
Rolling back to 14.1 still working fine

I can confirm it stopped working since v14.2. it seems to be related to changes in React facebook/react#28265, and the fix could be similar this: facebook/react#28351

I currently have pretty busy days, so I don't know when i will get to it, but I will try as soon as possible.

status update from my side
I didn't get into a proper investigation, but it seems it won't work well anyway. The official React devtools also don't work in most cases :/ - the source is usually some minified file

I have a hope in React Compiler in Next15 - it seems they include these component sources in the compiled bundle, we could use it, I don't know how yet, but we have some time till it gets released.

CleanShot 2024-05-27 at 09 01 37@2x

I have worked with new React and React DevTools. In the new version, React DevTools parses the source map and tries to find out the real position from it.

This means, in the old setup you should use _jsxDEV, and the fileName does all the work for you. In the new setup, you should use a precise source map (which might be slow in the dev), and configure the devtoolModuleFilenameTemplate (webpack) correctly.

Here is my webpack configuration:

  • output.devtoolModuleFilenameTemplate: join(import.meta.dirname, './src/[resource-path]')
  • devtool: source-map (the slowest&best one)

You will also need to apply this patch on the DevTools to make the webpack sourcemap work: facebook/react#29199

Looking forward to resolving it.

Is there an update on this?
Even a temporary hack to make it work with Next.js 15 will be helpful 🙏