Browse Source

添加 config.prod.js

yuedefeng 5 years ago
parent
commit
85d35060db

+ 188 - 0
src/dashoo.cn/frontend_web/nuxt.config.prod.js

@@ -0,0 +1,188 @@
+const webpack = require('webpack')
+module.exports = {
+  srcDir: 'src/',
+  // rootDir: './',
+  /*
+   ** Router config
+   */
+  router: {
+    middleware: [
+      'check-auth'
+    ]
+  },
+  /*
+   ** Headers of the page
+   */
+  head: {
+    title: '市场管理信息系统', //细胞制备系统
+    meta: [{
+        charset: 'utf-8'
+      },
+      {
+        name: 'viewport',
+        content: 'width=device-width, initial-scale=1'
+      },
+      {
+        hid: 'description',
+        name: 'description',
+        content: '市场管理信息系统'
+      }
+    ],
+    link: [{
+      rel: 'icon',
+      type: 'image/x-icon',
+      href: '/favicon.ico'
+    }],
+    script: [{
+        src: '/js/utils.js'
+      },
+      {
+        src: '/js/printUtilities.js'
+      }
+    ],
+  },
+  /*
+   ** Customize the progress bar color
+   */
+  loading: {
+    color: '#3B8070'
+  },
+  /*
+   ** Build configuration
+   */
+  build: {
+    babel: {
+      plugins: ['transform-decorators-legacy', 'transform-class-properties']
+    },
+    extend(config, {
+      isDev,
+      isClient
+    }) {
+      config.resolve.alias['class-component'] = '@/plugins/class-component'
+    },
+    /*
+     ** Run ESLint on save
+     */
+    // extend (config, ctx) {
+    //   if (ctx.dev && ctx.isClient) {
+    //     config.module.rules.push({
+    //       enforce: 'pre',
+    //       test: /\.(js|vue)$/,
+    //       loader: 'eslint-loader',
+    //       exclude: /(node_modules)/
+    //     })
+    //   }
+    // },
+    vendor: [
+      // 'axios',
+      'element-ui',
+      'negotiator',
+      'vue-class-component',
+      'vuex-class',
+      'vue-i18n',
+      'vue-chartjs',
+      'vue-clipboards',
+      'moment',
+      'chart.js',
+      'deepmerge' // vue-chartjs dep
+    ],
+    extractCSS: true,
+    filenames: {
+      vendor: 'vendor.[hash:12].js',
+      app: 'shanlan.[chunkhash:12].js',
+      css: 'shanlan.[contenthash:12].css'
+    },
+    plugins: [
+      new webpack.ContextReplacementPlugin(/moment[/\\]locale$/, /zh|en/)
+    ]
+  },
+
+  /*
+   ** Global CSS
+   */
+  css: [
+    // 'normalize.css/normalize.css',
+    'element-ui/lib/theme-chalk/index.css',
+    {
+      src: '~assets/styles/main.scss',
+      lang: 'scss'
+    }
+    // {src: '~assets/mstyles/index.scss', lang: 'scss'}
+  ],
+  /*
+   ** Add element-ui in our app, see plugins/element-ui.js file
+   */
+  plugins: [
+    '@/plugins/i18n',
+    '@/plugins/element-ui',
+    // '@/plugins/axios-defaults',
+    {
+      src: '@/plugins/clipboard',
+      ssr: false
+    },
+    {
+      src: '@/plugins/error-handler',
+      ssr: false
+    },
+    {
+      src: '@/plugins/vue-print-nb',
+      ssr: false
+    }
+  ],
+
+  modules: [
+    // '@nuxtjs/auth',
+    '~/modules/auth',
+    '@nuxtjs/axios',
+  ],
+  auth: {
+    user: {
+      endpoint: 'users/me',
+      propertyName: '',
+      resetOnFail: true
+    },
+    login: {
+      endpoint: 'auth'
+    },
+    logout: {
+      endpoint: 'auth/logout',
+      method: 'GET'
+    },
+    redirect: {
+      notLoggedIn: '/login',
+      loggedIn: '/'
+    },
+    token: {
+      enabled: true,
+      type: 'Bearer',
+      localStorage: true,
+      name: 'token',
+      cookie: true,
+      cookieName: 'token'
+    }
+  },
+
+
+  axios: {
+
+    /* --------Nuxt Start发版用 START-------------- */
+    baseURL: '/api/'
+    /* --------Nuxt Start发版用 END-------------- */
+
+  },
+  /*
+   ** 客户端和服务端共享的环境变量,
+   ** 客户端使用:process.env.appclient 服务端使用:context.appclient
+   */
+  env: {
+    /* --------Nuxt Start发版用 START-------------- */
+    
+    appclient:  'gfgl',                            //供方信息管理平台
+    upfilehost: '/uploadfile',                     //附件上传
+    baseURL:    '/api/',                           //本地工作流图片
+    LOCAL_IP:   '10.76.248.23'                     //定义服务器内网IP,word转PDF时用到
+    // API_URL:    'http://10.76.248.23:10091/api/'   //服务器渲染时调用
+
+    /* --------Nuxt Start发版用 END-------------- */
+  },
+}

+ 1 - 1
src/dashoo.cn/frontend_web/package.json

@@ -8,7 +8,7 @@
     "dev": "nuxt",
     "dev2": "nuxt -c nuxt.config.ignore.js",
     "build": "nuxt build",
-    "build2": "nuxt build --spa",
+    "build2": "nuxt build --spa -c nuxt.config.prod.js",
     "start": "cross-env HOST=0.0.0.0 PORT=9605 nuxt start",
     "start:pm2": "pm2 start yarn --name=shanlan -- start",
     "generate": "nuxt generate",