Nuxt How to set baseURL in dev or production
问题 This seems like a simple Nuxt question, but I just can't figure it out. When running "NPM run dev" I want to set the Axios baseURL to "localhost/api" and when running from the dist folder after "NPM run generate" I want the baseURL to be "/api". Is there a simple solution? 回答1: This is the way to do it: let development = process.env.NODE_ENV !== 'production' module.exports = { axios: { baseURL: development ? 'http://localhost:3001/api' : 'https://domain/api' }, modules: [ '@nuxtjs/axios' ], }