ericclemmons / click-to-component

Option+Click React components in your browser to instantly open the source in VS Code
MIT License
1.94k stars 75 forks source link

Add require exports #93

Open purple-force opened 3 weeks ago

purple-force commented 3 weeks ago

Describe the bug when require.resolve('click-to-component'), an error was thrown: Error [ERR_PACKAGE_PATH_NOT_EXPORTED]: No "exports" main defined in xxxxx//ode_modules/click-to-react-component/package.json

To Reproduce Steps to reproduce the behavior:

  1. npm i click-to-component
  2. See error

Expected behavior No error.

Screenshots If applicable, add screenshots to help explain your problem.

Desktop (please complete the following information):

Smartphone (please complete the following information):

Additional context Add any other context about the problem here.

purple-force commented 3 weeks ago

exports.require need to be added in package.json

Dmaziyo commented 3 weeks ago

i got the same issue

mustang1988 commented 3 weeks ago

i got the same issue when using ant-design-pro

Dmaziyo commented 3 weeks ago

i got the same issue when using ant-design-pro

You can revert the dependencies to the previously stable version (e.g., 1.0.8) as a temporary fix to start the project image

hogancv commented 3 weeks ago

i got the same issue when using ant-design-pro

purple-force commented 3 weeks ago

i got the same issue when using ant-design-pro

temporarily add require

image
YunHannn commented 3 weeks ago

image

image

编译一直报错 过不去 应该怎么解决啊

aapelismith commented 3 weeks ago

same issue here

fz6m commented 3 weeks ago

I don't think this is an error:

  1. in webpack project, it can build successfully, showing no issues with the recommended usage of this package.

  2. only having exports.import means this package strictly allows Native ESM imports only, and the following code runs correctly:

    // test.js
    
    import * as mod from 'click-to-react-component'
    
    const run = async () => {
      const mod2 = await import('click-to-react-component')
      console.log('mod: ', mod)
      // mod:  [Module: null prototype] { ClickToComponent: [Function (anonymous)] }
      console.log('mod2: ', mod2)
      // mod2:  [Module: null prototype] { ClickToComponent: [Function (anonymous)] }
    }
    
    run()
berber1016 commented 3 weeks ago

i got the same issue, how to fix?

berber1016 commented 3 weeks ago

i got the same issue, how to fix?

add resolutions to package.json

// package.json
  "resolutions": {
    "click-to-react-component":"1.1.0"
  }
QKflame commented 2 weeks ago

same issue

WindRisess commented 2 weeks ago

添加 "click-to-react-component":"1.0.8" 就可以解决了

giscafer commented 2 weeks ago

fix with below code add in package.json

  "resolutions": {
    "click-to-react-component": "1.0.8",
  },
wizardpisces commented 1 week ago

Same issue, any progress?