next-runtime-dotenv
Version:
Expose environment variables to the runtime config of Next.js
18 lines (14 loc) • 311 B
JavaScript
import getConfig from 'next/config'
const {
publicRuntimeConfig: {PUBLIC_VALUE},
serverRuntimeConfig: {SERVER_ONLY}
} = getConfig()
export default () => {
console.log('PUBLIC_VALUE', PUBLIC_VALUE)
console.log('SERVER_ONLY', SERVER_ONLY)
return (
<div>
Open your console!
</div>
)
}