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.
posted @ 2021-04-27 10:14  -起风了🪐  阅读(814)  评论(0编辑  收藏  举报