Created
January 9, 2024 12:21
-
-
Save shiftgeist/f496b5bafc36e0efc05468355350e061 to your computer and use it in GitHub Desktop.
Vite: Fetch package.json version
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const fetchVersion = () => { | |
return { | |
name: 'html-transform', | |
transformIndexHtml(html) { | |
return html.replace( | |
/__APP_VERSION__/, | |
`v${process.env.npm_package_version}` | |
) | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment