simplify next.config.js

main
Mike Fix 6 years ago committed by Michael Fix
parent 7fe3f3415f
commit 5cecbc912f

@ -1,23 +1,8 @@
// const { PHASE_DEVELOPMENT_SERVER } = require('next/constants') // const { PHASE_DEVELOPMENT_SERVER } = require('next/constants')
// const withOffline = require('next-offline') // const withOffline = require('next-offline')
module.exports = (/* phase { defaultConfig } */) => { module.exports = {
const config = { publicRuntimeConfig: {
async exportPathMap() { API_URL: process.env.API_URL || 'http://localhost:4000'
return {
'/about': { page: '/about' },
'/embed': { page: '/embed' },
'/index': { page: '/index' },
'/': { page: '/' }
}
},
publicRuntimeConfig: {
API_URL:
process.env.NODE_ENV === 'production'
? 'https://carbon-api.now.sh'
: 'http://localhost:4000'
}
} }
return config
} }

@ -12,7 +12,8 @@
], ],
"build": { "build": {
"env": { "env": {
"NODE_ENV": "production" "NODE_ENV": "production",
"API_URL": "@carbon_api_url"
} }
}, },
"github": { "github": {

Loading…
Cancel
Save