Using react-modal in custom _app.js in prod build results in server crash #13675
-
Bug reportDescribe the bugI'm pretty new to Next; however, I'm an experienced React dev and have come across quite a strange issue. I'm using a custom import { AuthContextProvider } from "../components/context/AuthContext";
const App = ({ Component, pageProps }) => {
return (
<AuthContextProvider>
<Component {...pageProps} />
</AuthContextProvider>
);
}; Nothing too controversial. The provider looks something like this (redacted a bit for brevity): import Modal from "react-modal";
export const AuthContextProvider = ({ children }) => {
...
return (
<AuthContext.Provider
value={{
user,
doLogin,
}}
>
<Modal
isOpen={loginModalIsOpen && !isFullUser}
onRequestClose={() => setLoginModalIsOpen(false)}
contentLabel="Log in"
>
<h1>Log in</h1>
<Login />
</Modal>
{user ? children : <Loading />}
</AuthContext.Provider>
);
}; This all works fine in local dev (Mac), but on the server (Firebase cloud function – presumably in production mode), any time I import This doesn't happen if I include Thanks! System information
|
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 4 replies
-
FWIW, in order to carry on dev, I've moved these Context providers into a This has left me wondering: what's special about |
Beta Was this translation helpful? Give feedback.
-
Damn and blast... @jamesmosier I've also done I guess I originally thought that it might have been a Next issue as I'll open an issue on that repo. Thanks for your support! 👍 |
Beta Was this translation helpful? Give feedback.
Damn and blast... @jamesmosier I've also done
next build && next start
locally and it works fine, which must mean that there must be something weird going on with the "Next on Firebase" starter that I used hereI guess I originally thought that it might have been a Next issue as
react-modal
works elsewhere in the app (and elsewhere in statically generated pages in the same app – just not those in_app.js
).I'll open an issue on that repo. Thanks for your support! 👍