cross-env 的作用

2021/4/27 10:56:06

本文主要是介绍cross-env 的作用,对大家解决编程问题具有一定的参考价值,需要的程序猿们随着小编来一起学习吧!

该命令是在node_modulesbin目录下,类似的脚本有cross-envcross-env-shell,在cross-env脚本中的内容如下:

#!/usr/bin/env node
'use strict';

var crossEnv = require('..');

crossEnv(process.argv.slice(2));

会把node_modules/bin的命令添加到环境变量中,比如:

    "start": "cross-env ESLINT=none PORT=3001  NO_PROXY=true roadhog dev",

cross-env的功能解决跨平台的环境变量的问题。。

cross-env makes it so you can have a single command without worrying about setting or using the environment variable properly for the platform. Just set it like you would if it's running on a POSIX system, and cross-env will take care of setting it properly.


这篇关于cross-env 的作用的文章就介绍到这儿,希望我们推荐的文章对大家有所帮助,也希望大家多多支持为之网!


扫一扫关注最新编程教程