kentcdodds / cross-env

🔀 Cross platform setting of environment scripts

Home Page:https://www.npmjs.com/package/cross-env

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

why create two process?

mh0625 opened this issue · comments

commented
  • cross-env version: 5.2.0
  • node version: 10.4.1
  • npm (or yarn) version: 6.1.0

Relevant code or config
package.json scripts:

"build-test": "cross-env ENV=test nuxt build",

What you did:

"build": "nuxt build",  // only one process

"build-test": "cross-env ENV=test nuxt build",  // have two process

What happened:

image

Problem description:

I want to use cross-env modify environment, when I execute npm run build-test command, it will create two process, why?

Because your actually calling the nuxt build again. It's a matter of package.json script scoping. just use "build-test": "cross-env ENV=test build". Since build is already defined above.

Did it solve the problem?

You have one process to run cross-env and cross-env spawns another process with the right environment variables set. There's no other way to do this I'm afraid.