| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283 |
- var projectname = process.argv[3];
- var glob = require("glob");
- 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"]
- }
- };
- } 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];
- 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
- console.log('projectname===')
- console.log(process.argv)
- console.log(projectname)
- var pages = getEntry();
- module.exports = {
- productionSourceMap: false, // 生产禁止显示源代码
- outputDir: "dist/" + projectname,
- pages: pages,
- lintOnSave: process.env.NODE_ENV === 'development',
- productionSourceMap: false,
- devServer: {
- port: port,
- open: true,
- 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]: ''
- }
- }
- }
- // 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')
- }
- }
- },
- };
|