Skip to content

Commit

Permalink
chore: print app version name to console
Browse files Browse the repository at this point in the history
  • Loading branch information
stdavis committed Sep 22, 2023
1 parent caaa4a1 commit a21b67c
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 3 deletions.
2 changes: 2 additions & 0 deletions src/main.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ import RootErrorFallback from './utah-design-system/RootErrorFallback.jsx';

const queryClient = new QueryClient();

console.log(`Enviro app version: ${import.meta.env.PACKAGE_VERSION}`);

ReactDOM.createRoot(document.getElementById('root')).render(
<ErrorBoundary FallbackComponent={RootErrorFallback}>
<React.StrictMode>
Expand Down
19 changes: 16 additions & 3 deletions vite.config.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,20 @@
import react from '@vitejs/plugin-react';
import { defineConfig } from 'vite';

// https://vitejs.dev/config/
/** @type {import('vite').UserConfig} */
export default {
plugins: [react()],
};
export default defineConfig({
plugins: [
react(),
{
// copied from: https://github.com/smnhgn/vite-plugin-package-version/blob/master/src/index.ts
name: 'vite-plugin-package-version',
config: () => {
const key = 'import.meta.env.PACKAGE_VERSION';
const val = JSON.stringify(process.env.npm_package_version);

return { define: { [key]: val } };
},
},
],
});

0 comments on commit a21b67c

Please sign in to comment.