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

Can't import the named export 'distance' #1007

Open
acerola1 opened this issue Nov 8, 2021 · 3 comments
Open

Can't import the named export 'distance' #1007

acerola1 opened this issue Nov 8, 2021 · 3 comments

Comments

@acerola1
Copy link

acerola1 commented Nov 8, 2021

I use your library in a React project. It runs just fine, and I quite fond of it.

Hovever I get an error message when I want to make a production build.

./node_modules/didyoumean2/dist/index.mjs
Can't import the named export 'distance' from non EcmaScript module (only default export is available)

I made a search and it seems that the react cli tools create-react-app could not handle a certain export type. I tried a suggested solution to add react-app-rewired and make a configuration change, but it is not working for me.

Now I stranded here.

@foray1010
Copy link
Owner

Can you try the cjs build?
./node_modules/didyoumean2/dist/index.cjs

@acerola1
Copy link
Author

acerola1 commented Nov 9, 2021

How can I use the cjs build? I import this way:

import didYouMean, { ReturnTypeEnums } from "didyoumean2";

@acerola1
Copy link
Author

I tried with import didYouMean, { ReturnTypeEnums } from "didyoumean2/dist/index.cjs";

The build failed with: Attempted import error: 'ReturnTypeEnums' is not exported from 'didyoumean2/dist/index.cjs''
My only workaround is that I use version 3.1.0

Any better idea?

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

No branches or pull requests

2 participants