didyoumean2 icon indicating copy to clipboard operation
didyoumean2 copied to clipboard

Can't import the named export 'distance'

Open acerola1 opened this issue 2 years ago • 3 comments

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.

acerola1 avatar Nov 08 '21 15:11 acerola1

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

foray1010 avatar Nov 09 '21 02:11 foray1010

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

import didYouMean, { ReturnTypeEnums } from "didyoumean2";

acerola1 avatar Nov 09 '21 07:11 acerola1

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?

acerola1 avatar Nov 21 '21 20:11 acerola1