Version defined in one place, available everywhere in your app

I just wanted to share this cool little tidbit I figured out tonight.

import { version } from '/package.json';

Now you only have to ever worry about updating your app’s version number in package.json, and it’s easily accessible throughout your code (I display it in a tiny font in the bottom left).


You can do the same for packages you depend on, btw! Definitely a cool trick.


That’s awesome! Coincidentally, you can also do this

import packageJson from '/package.json'

To get the whole package.json structure into a variable. I verified it on