I followed the steps from official documentation but I'm facing problem, this is how I did :
next.config.js
const nextConfig = {
reactStrictMode: true,
swcMinify: true,
env : {
MORALIS_ID: 'moralisId',
MORALIS_SERVER: 'moralisServer'
}
}
module.exports = nextConfig
And I call it like that :
<MoralisProvider serverUrl={process.env.MORALIS_SERVER} appId={process.env.MORALIS_ID}>
<Component {...pageProps} />
</MoralisProvider>
But when I console.log, I've got undefined and the error appear : ReactMoralisError: Provide a "appId" provided to <MoralisProvider>
So Next doesn't know the id.
What I did wrong ?
EDIT => even in my .env it doesn't work
EDIT AGAIN => I restart the server and it works, sorry guys and thanks for your time
CodePudding user response:
I restart the server and it works, sorry guys and thanks for your time
CodePudding user response:
Instead of next.config.js, Use .env.local, go throught https://nextjs.org/docs/basic-features/environment-variables