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
This discussion was converted from issue #12882 on May 25, 2020 12:22.
Heading
Bold
Italic
Quote
Code
Link
Numbered list
Unordered list
Task list
Attach files
Mention
Reference
Menu
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Bug report
Describe the bug
Hello!
I upgraded from 9.3.5 to 9.4.0 and decided to start switching from
getInitialProps
togetStaticProps
andgetServerSideProps
.I have
styled-components
in_document.js
injected exactly like in the example.I'm using firebase hosting, so I have to keep
functions
folder with its ownnode_modules
.When next.js starts logging
Automatically optimizing pages
message, React throws error about 'Invalid hook call'.I tried to modify next.config.js with
... but no luck.
Of course, I've checked versions of React: they are the same.
To sum it up:
_app.js
file is very simple.export default ({ Component, pageProps }) => <Component {...pageProps} />
_document.js
file is the same as in official example herefunctions
withnode_modules
next build
it fails after compiling onAutomatically optimizing pages
stageasync getInitialProps
to_app
or remove server-side styles from_document
it works again.node_modules
folder and keep server-side styles , it works tooSystem information
Additional context
How can I fix this issue using
externals
or via other features that comes from next.js?What kind of best-practice approach should I take?
Thank you!
Beta Was this translation helpful? Give feedback.
All reactions