hugh 的个人博客

vuePress-theme-reco hugh 的个人博客    2021
hugh 的个人博客

Choose mode

  • dark
  • auto
  • light
Home
分类
  • 前端
  • fe-robot
  • 前端监控
标签
专题
  • femonitor
  • jsby
  • fe-robot
TimeLine
工具
全版

hugh 的个人博客

154

Article

320

Tag

Home
分类
  • 前端
  • fe-robot
  • 前端监控
标签
专题
  • femonitor
  • jsby
  • fe-robot
TimeLine
工具
全版
  • 指定vuecli的config地址

指定vuecli的config地址

vuePress-theme-reco hugh 的个人博客    2021

指定vuecli的config地址


hugh 的个人博客 2020-06-15 21:15:00 前端webvuevuecli

# 指定环境变量

VUE_CLI_SERVICE_CONFIG_PATH: 用于指定config文件的配置参数

VUE_CLI_SERVICE_CONFIG_PATH=$PWD/vue2.config.js vue-cli-service build
1

# 使用node调用vue-cli-service

const {spawnSync} = require("child_process")

let rst = spawnSync('npx', ['vue-cli-service', 'build'], {
    env: {
      ...process.env, 
      VUE_CLI_SERVICE_CONFIG_PATH: `${process.cwd()}/vue.lib.config.js`
    },
  });
  
  if(rst && rst.stdout) {
     let infos = rst.stdout.toString().split('\n')
    // 处理结果	
}
1
2
3
4
5
6
7
8
9
10
11
12
13