You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hello @dai-shi, firstly, thanks for this awesome package, I just encounter a wired issue when I adopt this package. After deeply digging, i felt the root cause is about the "module field in package.json" probably.
The issue is when I running my application,I saw this error message:
./node_modules/react-hooks-global-state/src/index.js 68:6
Module parse failed: Unexpected token (68:6)
You may need an appropriate loader to handle this file type.
| const setGlobalState = (name, update) => {
| globalState = {
> ...globalState, <<< something wrong here
| [name]: updateValue(globalState[name], update),
| };
My application stack is
next.js@7.0.0
yarn@1.12.3
node@9.10.0
The wired thing is when I use npm will fix this issue. So I try to clone this code and use npm link to do some local testing, I found if I remove module field in package.json or change it to dist/index.js will fix this issue certainly.
Seems like module is still proposal and not sure if there's any different when developer use yarn or npm install the package.
NOTE: You may aware that above error is from the source code(src) instead of dist in the runtime
Could we fix this issue just remove the module field or change it to dist/index.js
Thanks
The text was updated successfully, but these errors were encountered:
@AllenFang Thanks for reporting this.
I assumed that bundler that uses module can deal esnext, but it's not true in your case.
So, CRA is fine, but not for next.js. Let me take some time to investigate it and deal with it.
Meanwhile, you can import dist directly. Hope it helps for your use case.
Hello @dai-shi, firstly, thanks for this awesome package, I just encounter a wired issue when I adopt this package. After deeply digging, i felt the root cause is about the "module field in package.json" probably.
The issue is when I running my application,I saw this error message:
My application stack is
next.js@7.0.0
yarn@1.12.3
node@9.10.0
The wired thing is when I use npm will fix this issue. So I try to clone this code and use npm link to do some local testing, I found if I remove
module
field in package.json or change it todist/index.js
will fix this issue certainly.Seems like
module
is still proposal and not sure if there's any different when developer use yarn or npm install the package.Could we fix this issue just remove the
module
field or change it todist/index.js
Thanks
The text was updated successfully, but these errors were encountered: