dotenv-webpack 라이브러리를 설치한다
yarn add dotenv-webpack
설치 후 next.config.js 에서 dotenv 플러그인을 연결해준다.
기존 next.config.js 파일
const Dotenv = require('dotenv-webpack')
const nextConfig = {
.... blah
webpack: (config) => {
config.plugins.push(new Dotenv({silent: true}))
return config
}
}
module.exports = nextConfig