Replies: 3 comments 1 reply
-
|
When I remove |
Beta Was this translation helpful? Give feedback.
0 replies
-
|
Also, converting the store to decorators fixed the issue 😕. In the Next.js project, it meant adding this module.exports = api => {
api.cache(true);
return {
presets: ['next/babel'],
plugins: [['@babel/plugin-proposal-decorators', { legacy: true }]],
};
}; |
Beta Was this translation helpful? Give feedback.
0 replies
-
|
Did you enable the class-fields-proposal in babel, and set it to using
loose mode? (strict mode will only be supported in v6 which is currently in
beta)
…On Sun, Sep 13, 2020 at 8:22 PM Borek Bernard ***@***.***> wrote:
Also, converting the store to decorators fixed the issue 😕.
In the Next.js project, it meant adding this babel.config.js:
module.exports = api => {
api.cache(true);
return {
presets: ['next/babel'],
plugins: ***@***.***/plugin-proposal-decorators', { legacy: true }]],
};
};
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#2449 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAN4NBD3BHL5JU5B4TJETJLSFULWTANCNFSM4RK2NTEQ>
.
|
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
I've got a simple CartStore that looks like this:
In plain JS example in this CodeSandbox, everything works fine, however, in our Next.js + TypeScript project, it fails with
Cannot read property 'reduce' of undefinedin the getter.This is the full stacktrace during SSR:
Putting
console.log(this)to the getter shows this:Perhaps the array is transformed to some kind of wrapper? I thought that this was a behavior of MobX a long time ago, is it possible that Next.js transpiles to some very old version of JS or something?
Versions used:
{ "dependencies": { "mobx": "5.15.4", "mobx-react": "6.1.8", "react": "16.13.1", "react-dom": "16.13.1" } }Beta Was this translation helpful? Give feedback.
All reactions