-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
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
Support process.env.npm_package_version
Inlining
#8470
Comments
According to the docs, you can add this to your
|
I do think that in the spirit of node emulation, all |
Using parcel's `inlineEnvironment` parcel-bundler/parcel#8470 (comment) to inline the version so the whole package.json content is not included in the bundle Must use `"context": "browser"` for targets.main and targets.module, default context "node" can't inline `process.env.npm_package_version` Added @types/node for `process`'s type definition Closes peers#1322
Not only this, but user has to use But why with context "node" it doesn't inline |
…because Node already supports it.
Currently it seems that there are no way to include the version field in
package.json
without prependingcross-env NPM_PACKAGE_VERSION=$npm_package_version
to the parcel commands. That's verbose, and requirescross-env
to be installed.Of course you might say, I could just import the JSON file directly by
import { version } from "../package.json"
. But that requires manually turningresolveJsonModule
on. Moreover, this will including the whole JSON file, exposing other useless information in the bundle. I hate importing things outsidesrc
either.Some people might want
npm_package_name
andnpm_package_description
too.The text was updated successfully, but these errors were encountered: