指定 vue-cli vue.config.js 位置 [英] Specify a vue-cli vue.config.js location

查看:92
本文介绍了指定 vue-cli vue.config.js 位置的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的项目的基本目录中有一个 vue.config.js 文件.我想将它移到 /config/ 文件夹中的其他配置文件旁边.

I have a vue.config.js file in my project's base directory. I'd like to move this next to my other config files in a /config/ folder.

如何为 vue-cli 指定此文件的新位置?

How can I specify the new location of this file for vue-cli?

推荐答案

环境变量 VUE_CLI_SERVICE_CONFIG_PATH 指定vue.config.js的绝对路径代码>.此变量的相对路径在 macOS(可能还有其他平台)上失败.

The environment variable VUE_CLI_SERVICE_CONFIG_PATH specifies the absolute path to vue.config.js. Relative paths for this variable fail on macOS (and probably other platforms).

命令行示例:

$ VUE_CLI_SERVICE_CONFIG_PATH=$PWD/config/vue.config.js npm run build

或者在 package.json 中:

{
  "scripts": {
    "build": "VUE_CLI_SERVICE_CONFIG_PATH=$PWD/config/vue.config.js vue-cli-service build"
  }
}

这篇关于指定 vue-cli vue.config.js 位置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆