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

NPM/Yarn import not working with React #9

Closed
sasham43 opened this issue Jan 10, 2022 · 3 comments
Closed

NPM/Yarn import not working with React #9

sasham43 opened this issue Jan 10, 2022 · 3 comments
Labels
bug Something isn't working

Comments

@sasham43
Copy link
Contributor

Describe the bug
When attempting to import swiffyslider into a React project, I get Module not found: Can't resolve 'swiffy-slider'.

To Reproduce
Steps to reproduce the behavior:

  1. Run yarn add swiffy-slider in fresh project.
  2. Create index.js with import swiffyslider from 'swiffy-slider
  3. Run node index.js

Expected behavior
The swiffyslider object is imported into the file, and I can use it.

Additional context
In attempting to debug this issue, I think part of it has to do with the package.json (it has "main": "dist/swiffy-slider.ESM.min.js" when I think it should be "main": "dist/js/swiffy-slider-ESM.min.js"). I think there might be an issue with ES6 Module Syntax vs CommonJS syntax.

@nicped
Copy link
Member

nicped commented Jan 11, 2022

Yes, it is because the src folder is missing from the npm package. Will fix this and at the same time make the package esm compatible as well. Thanks for observing.

@nicped nicped added the bug Something isn't working label Jan 11, 2022
@sasham43
Copy link
Contributor Author

Ah okay! Thanks for the quick response!

@nicped
Copy link
Member

nicped commented Jan 17, 2022

Should be foxed wit 1.3 release! Thanks again.

@nicped nicped closed this as completed Jan 17, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants