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

[Bug]: Cannot find module 'embla-carousel/components/Options' or its corresponding type declarations. TypeScript, React with Vite #780

Closed
5 of 14 tasks
rxtsel opened this issue Feb 29, 2024 · 2 comments
Assignees
Labels
bug Something isn't working resolved This issue is resolved typescript Issue is related to TypeScript

Comments

@rxtsel
Copy link

rxtsel commented Feb 29, 2024

Which variants of Embla Carousel are you using?

  • embla-carousel (Core)
  • embla-carousel-react
  • embla-carousel-vue
  • embla-carousel-svelte
  • embla-carousel-autoplay
  • embla-carousel-auto-scroll
  • embla-carousel-solid
  • embla-carousel-auto-height
  • embla-carousel-class-names
  • embla-carousel-docs (Documentation)
  • embla-carousel-docs (Generator)

Steps to reproduce

It seems that the issue stems from the way OptionsType is imported in the useEmblaCarousel.d.ts file within the embla-carousel-react folder in node_modules. Instead of importing directly from 'embla-carousel/components/Options', it should be imported directly from the EmblaOptionsType type.

Expected Behavior

expect

Received behavior

return

Additional Context

The bug occurs when I build:

image

What browsers are you seeing the problem on?

No response

Version

v8.0.0

CodeSandbox

No response

Before submitting

  • I've made research efforts and searched the documentation
  • I've searched for existing issues
  • I agree to follow this project's Contributing Guidelines for bug reports
@rxtsel rxtsel added the bug Something isn't working label Feb 29, 2024
@davidjerleke
Copy link
Owner

davidjerleke commented Mar 1, 2024

Hi @rxtsel,

Thanks for the bug report. It seems like many devs are having this problem.

Setting moduleResolution to node in tsconfig solves it, but I don’t know why yet.

Feel free to help me out and read about the new bundler option that TypeScript introduced recently which is causing these errors.

It seems that the issue stems from the way OptionsType is imported in the useEmblaCarousel.d.ts file within the embla-carousel-react folder in node_modules. Instead of importing directly from 'embla-carousel/components/Options', it should be imported directly from the EmblaOptionsType type.

Best,
David

@davidjerleke davidjerleke added typescript Issue is related to TypeScript help wanted Feel free to help out labels Mar 1, 2024
@rxtsel
Copy link
Author

rxtsel commented Mar 1, 2024

Hi @davidjerleke,

Thanks for responding.

Indeed, changing the value of moduleResolution from bundler to node worked for me. Thank you very much, we can close this issue, although it would be good if it detected whether that line is needed and added it or changed the value if necessary. Or simply add it to the documentation.

@rxtsel rxtsel closed this as completed Mar 1, 2024
@davidjerleke davidjerleke added resolved This issue is resolved and removed help wanted Feel free to help out labels Mar 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working resolved This issue is resolved typescript Issue is related to TypeScript
Projects
None yet
Development

No branches or pull requests

2 participants