Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add require exports #93

Open
purple-force opened this issue Nov 4, 2024 · 15 comments · May be fixed by #94
Open

Add require exports #93

purple-force opened this issue Nov 4, 2024 · 15 comments · May be fixed by #94

Comments

@purple-force
Copy link

purple-force commented Nov 4, 2024

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):

  • OS: [e.g. iOS]
  • Browser [e.g. chrome, safari]
  • Version [e.g. 22]

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
Add any other context about the problem here.

@purple-force
Copy link
Author

exports.require need to be added in package.json

@Dmaziyo
Copy link

Dmaziyo commented Nov 4, 2024

i got the same issue

@mustang1988
Copy link

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

@Dmaziyo
Copy link

Dmaziyo commented Nov 4, 2024

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
Copy link

hogancv commented Nov 4, 2024

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

@purple-force
Copy link
Author

purple-force commented Nov 4, 2024

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

temporarily add require
image

@YunHannn
Copy link

YunHannn commented Nov 4, 2024

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

@aapelismith
Copy link

same issue here

@fz6m
Copy link

fz6m commented Nov 4, 2024

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()

@fz6m fz6m linked a pull request Nov 4, 2024 that will close this issue
@berber1016
Copy link

i got the same issue, how to fix?

@berber1016
Copy link

i got the same issue, how to fix?

add resolutions to package.json

// package.json
  "resolutions": {
    "click-to-react-component":"1.1.0"
  }

@QKflame
Copy link

QKflame commented Nov 6, 2024

same issue

@WindRisess
Copy link

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

@giscafer
Copy link

giscafer commented Nov 7, 2024

fix with below code add in package.json

  "resolutions": {
    "click-to-react-component": "1.0.8",
  },

@wizardpisces
Copy link

Same issue, any progress?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.