App Version
See original GitHub issueHi,
I’m looking for a way to inject an app version, so it could be used by the app (for analytics, debugging, etc). Usually I use the app’s package.json
, taking advantage of npm version command. But import is only allowed from within src/ as can be seen in ModuleScopePlugin.
I wanted to know if there’s another solution to this general problem (app versioning), or if the app’s package.json
can just be allowed to be imported by the scope plugin
As a workaround I just created a symlink to package.json
in src/
, which is nice, in a way, because you can see the app is dependent on it, but for me it’s a common pattern (using the package.json), so maybe it’s better just to allow it
Issue Analytics
- State:
- Created 6 years ago
- Comments:11 (6 by maintainers)
Top Results From Across the Web
Version your app - Android Developers
Set app version information. To define the version information for your app, set values for the version settings in the Gradle build files:....
Read more >App Version Software Updates - Apps on Google Play
With this app, you can easily find out which app (installed in your device) has latest update version available on Playstore. The app...
Read more >App version numbers - IBM
The app version that displays in the app store, and it is the first number that is displayed in MobileFirst Quality Assurance. In...
Read more >App Version | Cordova Plugin App Version to Read Ionic Apps
The App Version feature reads the version of your Ionic app from the target build settings. Usage requires the cordova-plugin-app-version.
Read more >How To Find Out What Version of An Android App You're ...
Sometimes on Android, you need to know the version of a particular app you are running. Here's how to find the info you...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Just learned this little trick: you can use
$npm_package_version
to access the current value ofversion
inpackage.json
(before react-scripts strips out all the env variables). To make this work across windows and Mac, you could leveragecross-env
to do:This will make the current value of
version
inpackage.json
accessible from inside your project viaprocess.env.REACT_APP_VERSION
(or inpublic/index.html
via%REACT_APP_VERSION%
)If you’re just targeting Mac, no need for
cross-env
. You can do:BEWARE:
import { version } from '../package.json'
exposes the whole ofpackage.json
in the build bundle, not just the version!