Closed cduff closed 3 years ago
Please read the release notes.
https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c
I would probably wait upgrading until TS 4.5 is out, which has better ESM support.
Thanks for your response @sindresorhus.
p-memoize
moved to pure ESM at v5.0.0. This, as well as the subsequent v5.0.1, were working with create-react-app. So I was therefore confused when v6.0.0 stopped working.
Was there some additional change made in v6.0.0 that doesn't work with the ESM support of CRA? I couldn't see anything mentioned in the release notes.
Hmm. The package was rewritten in TS, but that should not have been an observable change. Anyway, I don't think it's worth looking into this as I said, TS will improve its ESM compatibility in 4.5 which will be out soon.
FYI @sindresorhus I just had a bit more of a look at this.
The problem is caused by a change in package.json
from
"exports": "./index.js",
to
"exports": "./dist/index.js",
i.e. adding a subpath to exports breaks it. I tested hacking the package to remove the subpath and it works again.
I went looking for potentially associated outstanding issues against create-react-app and found the following:
https://github.com/facebook/create-react-app/issues/10933 https://github.com/facebook/create-react-app/issues/10892 https://github.com/facebook/create-react-app/issues/11528
So it seems there are known issues with create-react-app around this.
FYI, the latest version of p-memoize (6.0.1) now works with the newly released version of create-react-app (5.0.0).
I was previously using
p-memoize
v5.0.1 successfully in a create-react-app project. When I try upgrading to the newp-memoize
v6.0.0 I get errors like:Steps to reproduce:
p-memoize
as a dependency in the project:p-memoize
in e.g.index.tsx
:This results in an error message as above. It works if you downgrade
p-memoize
to v5.0.1.