-
Notifications
You must be signed in to change notification settings - Fork 92
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
useCookieValue esm & esnext imports don't work #659
Comments
🤔 never faced the issue, since i'm transpiling We're unable to switch to |
One option I can think of could be make
|
@jakubriedl barely it is caused by js cookie. Is any of other hooks viable via esm import? Reexporting |
all other hooks that are imported directly from index work for us, its just What kind of error would users experience if it would be exported in index and using optional require? |
I've recently come across exports field in package.json which might be the way how to solve that. |
@jakubriedl it is only suitable for |
@jakubriedl @xobotyi I have the exact same problem, and only the CJS import works. I would like to add that also following the docs, |
It is described in hook docs, that it is not exported from the index file, because of optional dependency. |
When I try to import
useCookieValue
fromesm
oresnext
it fails with errorSyntaxError: Cannot use import statement outside a module
Prior Issues
haven't found anything relevant
What is the current behavior?
when building our Next.js app it works when importing
cjs
but crashes when importingesm
oresnext
with errorSyntaxError: Cannot use import statement outside a module
.I think/guess it is caused by the fact that
package.json
lists"esnext": "esnext/index.js", "module": "esm/index.js",
. Which if I understand what that means is when we import from nested file it isn't recognised as "module" and so it useimport
syntax.The text was updated successfully, but these errors were encountered: