| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135 |
- var projectname = process.argv[3];
- var glob = require("glob");
- var publicPath = ''
- function getEntry() {
- var entries = {};
- if (process.env.NODE_ENV == "production") {
- entries = {
- index: {
- // page的入口
- entry: "src/views/" + projectname + "/main.js",
- // 模板来源
- template: "public/index.html",
- // 在 dist/index.html 的输出
- filename: "index.html",
- title: projectname,
- chunks: ["chunk-vendors", "chunk-common", "index"]
- }
- };
- publicPath = '/' + projectname + '/'
- } else {
- var items = glob.sync("./src/views/*/*.js");
- for (var i in items) {
- var filepath = items[i];
- var fileList = filepath.split("/");
- var fileName = fileList[fileList.length - 2];
- publicPath = '/' + fileName + '/'
- entries[fileName] = {
- entry: `src/views/${fileName}/main.js`,
- // 模板来源
- template: `public/index.html`,
- // 在 dist/index.html 的输出
- filename: `${fileName}.html`,
- };
- }
- }
- return entries;
- }
- const path = require('path')
- function resolve(dir) {
- return path.join(__dirname, dir)
- }
- const port = process.env.port || process.env.npm_config_port || 12004 // dev port
- const name = 'vue Admin Template' // page title
- var pages = getEntry();
- console.log(process.env.VUE_APP_ZL_WSS, 'process.env.VUE_APP_ZL_WSS')
- console.log(process.env.VUE_APP_BASE_API, 'process.env.VUE_APP_ZL_WSS')
- module.exports = {
- // publicPath:'/weibao/',
- publicPath: publicPath,
- productionSourceMap: false, // 生产禁止显示源代码
- outputDir: "dist/" + projectname,
- pages: pages,
- lintOnSave: process.env.NODE_ENV === 'development',
- productionSourceMap: false,
- devServer: {
- port: port,
- open: true,
- https: false,
- overlay: {
- warnings: false,
- errors: true
- },
- proxy: {
- [process.env.VUE_APP_BASE_API]: {
- target: 'https://test.poteviohealth.com/pmgw/',
- // target: 'http://localhost:12017/',
- changeOrigin: true,
- secure: false,
- pathRewrite: {
- ['^' + process.env.VUE_APP_BASE_API]: ''
- }
- },
- //
- [process.env.VUE_APP_ZL_WSS]: {
- target: 'https://cdbwss.poteviohealth.com/api/',
- // target: 'http://localhost:12017/',
- changeOrigin: true,
- secure: false,
- pathRewrite: {
- ['^' + process.env.VUE_APP_ZL_WSS]: ''
- }
- },
- [process.env.VUE_APP_ZL_WSS_ZP]: {
- target: 'https://web.poteviohealth.com/prod-api',
- // target: 'http://localhost:12017/',
- changeOrigin: true,
- secure: false,
- pathRewrite: {
- ['^' + process.env.VUE_APP_ZL_WSS_ZP]: ''
- }
- },
- [process.env.VUE_APP_ZL_WSS_ZP_BT]: {
- target: 'https://test.poteviohealth.com/subsidy',
- // target: 'http://localhost:12017/',
- changeOrigin: true,
- secure: false,
- pathRewrite: {
- ['^' + process.env.VUE_APP_ZL_WSS_ZP_BT]: ''
- }
- },
- [process.env.VUE_APP_ZL_JF]: {
- target: 'https://jifen.tjpoteviohealth.com/blade-api',
- // target: 'http://localhost:12017/',
- changeOrigin: true,
- secure: false,
- pathRewrite: {
- ['^' + process.env.VUE_APP_ZL_JF]: ''
- }
- },
- [process.env.VUE_APP_ZL_HEALTH]: {
- target: 'http://web.poteviohealth.com:8080/',
- // target: 'http://localhost:12017/',
- changeOrigin: true,
- secure: false,
- pathRewrite: {
- ['^' + process.env.VUE_APP_ZL_HEALTH]: ''
- }
- }
- }
- // after: require('./mock/mock-server.js')
- },
- configureWebpack: {
- // provide the app's title in webpack's name field, so that
- // it can be accessed in index.html to inject the correct title.
- name: name,
- resolve: {
- alias: {
- '@': resolve('src')
- }
- }
- },
- };
|