Cannot import Dropzone using Typescript
See original GitHub issueDo you want to request a feature or report a bug?
- I found a bug
What is the current behavior?
When I have the line import Dropzone from 'react-dropzone';
at the top of my file in typescript I’m unable to compile with the following error:
ERROR in [at-loader] ./src/client/components/uploader.tsx:2:8 TS1192: Module '"/Users/ashokraju/src/sc/caas-app/node_modules/@types/react-dropzone/index"' has no default export.
If the current behavior is a bug, please provide the steps to reproduce.
- Add line
import Dropzone from 'react-dropzone';
to top of React component file. - Try to compile the file.
- Get the above error.
What is the expected behavior? Should be able to compile.
In believe this is an issue with the type definitions?
Issue Analytics
- State:
- Created 6 years ago
- Reactions:4
- Comments:5
Top Results From Across the Web
Module not found: Error: Can't resolve 'dropzone'
In order to use the DropZone type in my typescript code, I first installed it using npm install --save-dev @types/dropzone .
Read more >react-dropzone - npm
Start using react-dropzone in your project by running `npm i ... TypeScript icon, indicating that this package has built-in type ...
Read more >react-dropzone
Simple React hook to create a HTML5-compliant drag'n'drop zone for files. Documentation and examples at https://react-dropzone.js.org.
Read more >Create a drag-and-drop with react-dropzone - LogRocket Blog
To create a drag-and-drop component with react-dropzone , all we need to do is copy and paste the snippets in our App.js file:...
Read more >Create a Drag-and-Drop zone in React with react-dropzone
Right now, our code should be looking something like this in our App.js component. import React from "react"; function App() { return <div></div>;...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@oyvindym This solution works for me only with version 4.1.3
maybe
"module": "dist/es/index.js",
let the type file not working but it is only my opinion.See: https://github.com/react-dropzone/react-dropzone/compare/v4.1.3...v4.2.1
Got the exact same bug.
Also, if I import Dropzone using
import * as Dropzone from 'react-dropzone';
I get the following error when mounting the component:Using following package versions: