.next 라는 빌드 결과물의 폴더 이름을 변경하거나 빌드 할 때마다 생성되는 build id 등을 고정할 수도 있다.ex) "yarn dev"로 프로젝트를 실행하면 개발모드의 API를, “yarn build”로 프로젝트를 실해하면 production의 API를 가져오는 코드를 만든다.
const env = process.env.NODE_ENV;
switch (env) {
case 'development':
API_URL = '<http://localhost:8080>;
break;
case 'staging':
API_URL = '<https://stg.api.evereathing.com>';
break;
case 'production':
API_URL = '<https://api.evereathing.com>';
break;
default:
API_URL = '<https://api.evereathing.com>';
}
module.exports = {
env: {
API_URL
}
};