Command causing cross-shell-env to fail silently
chrisahardie opened this issue · comments
cross-env
7.0.2:node
version: 12.6.1npm
(oryarn
) version: 6.13.4
Relevant code or config
// package.json
"dependencies": {
"react": "^16.13.0",
"react-dom": "^16.13.0",
"react-scripts": "3.4.1",
},
devDependencies: {
"cross-env": "7.0.2",
}
"scripts": {
"start": "react-scripts start",
"build:prod": "node -r dotenv/config node_modules/react-scripts/scripts/build.js dotenv_config_path=config/.env.production",
"dynamicBuild:prod": "cross-env NODE_APP_INSTANCE=\"production\" npm run dynamicBuild",
"dynamicBuild": "cross-env-shell \"node -r dotenv/config node_modules/react-scripts/scripts/build.js dotenv_config_path=config/.env.$NODE_APP_INSTANCE\"",
What you did:
I have created a working build:prod
script that reads in a environment file.
I then attempted to break my build:prod
up so that I could create adynamicBuild
script that I could use when building for different environments.
What happened:
When I execute dynamicBuild:prod
I get very little output:
> hui-new-gen@0.1.0 dynamicBuild:prod C:\Users\chardie\Documents\Repos\hui-new-gen
> cross-env NODE_APP_INSTANCE="production" npm run dynamicBuild
> hui-new-gen@0.1.0 dynamicBuild C:\Users\chardie\Documents\Repos\hui-new-gen
> cross-env-shell "node -r dotenv/config node_modules/react-scripts/scripts/build.js dotenv_config_path=config/.env.$NODE_APP_INSTANCE"
I have identified the issue as the dotenv_config_path
flag in dynamicBuild
- if I remove it, my build will at least kick off, though obviously not with the desired env file.
Since I'm not getting any feedback, is there something I can do to get some more verbose logging?
Reproduction repository:
https://github.com/chrisahardie/cross-env-repo
Problem description:
cross-env-shell
is not kicking off a build if the dotenv_config_path flag is set.
Suggested solution:
this issue is similar to my issue, my deduction is the equal sign (=) fail the command
here is how I test it
"test":"cross-env-shell \"echo testing\""
print out testing
"test":"cross-env-shell \"echo 123\""
print out 123
"test":"cross-env-shell \"echo testing=123\""
print nothing