click-to-component icon indicating copy to clipboard operation
click-to-component copied to clipboard

TypeError: Cannot read properties of undefined (reading 'columnNumber')

Open bluelovers opened this issue 2 years ago • 4 comments

Describe the bug A clear and concise description of what the bug is.

To Reproduce Steps to reproduce the behavior:

  1. Go to '...'
  2. Click on '....'
  3. Scroll down to '....'
  4. See error

Expected behavior A clear and concise description of what you expected to happen.

Screenshots

image

Desktop (please complete the following information):

  • OS: windows

image

Smartphone (please complete the following information):

  • Device: [e.g. iPhone6]
  • OS: [e.g. iOS8.1]
  • Browser [e.g. stock browser, safari]
  • Version [e.g. 22]

Additional context

Next.js v13.1.6-canary.3 react 18

bluelovers avatar Feb 03 '23 02:02 bluelovers

I ran into the same issue while trying to use this with nextjs 13. I think this is because this lib is using the __source attribute generated by @babel/plugin-transform-react-jsx-source in order to work. However nextjs 13 is now using their new swc transformer and thus the __source is missing, resulting in this error.

So one way to make this work with nextjs 13 may be to use babel instead of swc by creating a .babelrc file at the root of the project. (I could not try this myself because I need swc).

Another possible way could be to generate the __source attribute with swc. I found this option in swc's documentation but I could not find a way to enable it in nextjs 13, it seems they don't support a custom .swcrc at the moment

atersolis avatar Mar 14 '23 15:03 atersolis

Also having this issue, but we aren't using Babel nor SWC, as the other comment indicated. We use only tsc.

dbersan avatar Nov 07 '23 10:11 dbersan

Please prioritise this issue. It has a severe impact on workflow. P.S. I'm using Next.j 14.0.3 and the new App Router.

spacecat avatar Nov 27 '23 12:11 spacecat

The issue was introduced by the babel plugin transform react jsx source in v7.9.0

Since newer plugin versions dont support retrieving a column number anmyore, 0 should be used as a fallback imo. The column number isnt that important, since we only look for whole components anyway.

https://babeljs.io/docs/babel-plugin-transform-react-jsx-source

LeonMueller-OneAndOnly avatar Dec 15 '23 13:12 LeonMueller-OneAndOnly