const pkg = require('./package') const DevBaseUrl = 'http://127.0.0.1:65534' const ProdBashUrl = 'https://api.wyr.me' module.exports = { mode: 'universal', /* ** Headers of the page */ head: { title: '轶哥 - 火星人', htmlAttrs: { lang: 'zh-cn' }, meta: [{ charset: 'utf-8' }, { name: 'viewport', content: 'width=device-width, initial-scale=1, user-scalable=no' }, { 'http-equiv': 'X-UA-Compatible', content: 'IE=edge, chrome=1' }, { hid: 'description', name: 'description', content: '一个全栈程序员的技术博客。' }, { hid: 'keywords', name: 'keywords', content: '轶哥,王轶,全栈,程序员,技术博客' } ], link: [{ rel: 'stylesheet', href: 'https://cdn.wyr.me/css/begin.css' }, { rel: 'stylesheet', href: 'https://cdn.wyr.me/css/highlight/atom-one-light.css' }, { rel: 'icon', type: 'image/x-icon', href: '/favicon.ico' } ] }, /* ** Customize the progress-bar color */ loading: { color: '#3B8070' }, /* ** Global CSS */ css: [], /* ** Plugins to load before mounting the App */ plugins: [{ src: '~/plugins/moment.js' }, { src: '~/plugins/vue.js', ssr: true }, { src: '~/plugins/browser.js', ssr: false }, { src: '~/plugins/vue-js-modal', mode: 'client' }, { src: '~/plugins/vue-toasted', mode: 'client' }, { src: '~/plugins/v-viewer', mode: 'client' } ], /* ** Nuxt.js modules */ modules: [ // Doc: https://axios.nuxtjs.org/usage '@nuxtjs/axios' ], /* ** Axios module configuration */ axios: { // See https://github.com/nuxt-community/axios-module#options baseURL: process.env.NODE_ENV === 'development' ? DevBaseUrl : ProdBashUrl // 配置API接口地址 }, /* ** Build configuration */ build: { /* ** You can extend webpack config here */ extend (config, ctx) { // Run ESLint on save if (ctx.isDev && ctx.isClient) { config.module.rules.push({ enforce: 'pre', test: /\.(js|vue)$/, loader: 'eslint-loader', exclude: /(node_modules)/ }) } }, vendor: ['moment'], babel: { plugins: [ [ 'component', { libraryName: 'element-ui', styleLibraryName: 'theme-chalk' } ] ] } }, env: { version: pkg.version, baseURL: process.env.NODE_ENV === 'development' ? DevBaseUrl : ProdBashUrl } }