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

No Default Export in Typescript #15

Open
ghost opened this issue Apr 12, 2018 · 1 comment
Open

No Default Export in Typescript #15

ghost opened this issue Apr 12, 2018 · 1 comment
Labels

Comments

@ghost
Copy link

ghost commented Apr 12, 2018

import Croppr from 'croppr';

[ts] Module '"/node_modules/croppr/index"' has no default export.

@jamesssooi
Copy link
Owner

I understand that this problem appears when you try to compile a TypeScript file, correct me if I'm wrong. There are differences to how modules are handled between TypeScript when compared to other bundlers like Babel or Webpack. Seems like you have a few solutions:

Option 1:
Modify your import statement to import * as Croppr from 'croppr'

Option 2:
Add the following configuration in your tsconfig.json file:

{
  "compilerOptions": {
    "esModuleInterop": true
  }
}

I will look into how we can prevent this from happening in the first place. Would appreciate if someone could provide some pointers into this!

Further reading:
microsoft/TypeScript-React-Starter#8
microsoft/TypeScript#2242 (comment)

@jamesssooi jamesssooi added the bug label Apr 12, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant