cross-env 的作用
该命令是在node_modules
的bin
目录下,类似的脚本有cross-env
和cross-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.
联系我->邮件写信