infi-pc / locatorjs

https://www.locatorjs.com
1.31k stars 60 forks source link

bug: Not working in NextJs 14.2.2 #153

Open timscullin opened 4 months ago

timscullin commented 4 months ago

Where the bug happens

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

infi-pc commented 4 months ago

I can confirm it stopped working since v14.2. it seems to be related to changes in React https://github.com/facebook/react/pull/28265, and the fix could be similar this: https://github.com/facebook/react/pull/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.

infi-pc commented 3 months ago

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

Jack-Works commented 3 months ago

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:

You will also need to apply this patch on the DevTools to make the webpack sourcemap work: https://github.com/facebook/react/pull/29199/

liubin595338764 commented 2 months ago

Looking forward to resolving it.

nirtamir2 commented 3 weeks ago

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