-
Notifications
You must be signed in to change notification settings - Fork 3.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[BUG] $npm_package_dependencies_* are no longer set in v7 #3022
Comments
This was an intentional change; you’re intended to read the json file in a script instead of relying on the env. |
@ljharb this is quite inconvenient however - e.g. Also, the exclusion of |
Indeed; seems like the docs need updating. |
Thanks! For the time being, I found a workaround thanks to your suggestion: "scripts": {
"start": "npm run react-cli start",
"build": "npm run react-cli build",
"react-cli": "node -r ./scripts/react-env.js node_modules/.bin/react-scripts"
} // ./scripts/react-env.js
const package = require("./package");
process.env.REACT_APP_FIREBASE_VERSION = package.dependencies.firebase; |
keeping open to track updating the documentation to be more clear about this 👍 |
so when I have a simple npm script that just needs the version string of some dependency (to use as input to a third party script), I am supposed to write a separate nodejs-script to parse package.json (which npm already must have done) and extract that string myself? That is extremely disappointing |
Can you explain why? It was really helpful and npm_package_name is still working but e.g. npm_package_repository_* is missing as well. It took me some time to find this issue and understand why some fields are working and some not. |
At least for my use case E.g.: |
Current Behavior:
Any
$npm_package_dependencies_*
variables defined in v6, are no longer set in v7.Expected Behavior:
$npm_package_dependencies_*
variables should list the values frompackage.json
Steps To Reproduce:
npm_package_*
variables are present, but not any ofnpm_package_dependencies_*
Environment:
OS:
Ubuntu 20.10
Node:
v15.12.0
npm:
7.8.0
The text was updated successfully, but these errors were encountered: