mirror of
https://github.com/MetaCubeX/metacubexd.git
synced 2024-11-10 05:15:35 +08:00
feat: get package.json version from npm builtin environment variable
This commit is contained in:
parent
eb6944fb2a
commit
0cdf390c28
@ -497,7 +497,7 @@ const Versions: Component<{ backendVersion: Accessor<string> }> = ({
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<div class="grid grid-cols-2 gap-4">
|
<div class="grid grid-cols-2 gap-4">
|
||||||
<kbd class="kbd">{import.meta.env.version}</kbd>
|
<kbd class="kbd">{import.meta.env.VITE_APP_VERSION}</kbd>
|
||||||
|
|
||||||
<div class="relative">
|
<div class="relative">
|
||||||
<Show when={isUpdateAvailable()}>
|
<Show when={isUpdateAvailable()}>
|
||||||
|
2
src/vite-env.d.ts
vendored
2
src/vite-env.d.ts
vendored
@ -1,5 +1,5 @@
|
|||||||
interface ImportMetaEnv {
|
interface ImportMetaEnv {
|
||||||
readonly version: string
|
readonly VITE_APP_VERSION: string
|
||||||
}
|
}
|
||||||
|
|
||||||
interface ImportMeta {
|
interface ImportMeta {
|
||||||
|
@ -1,18 +1,13 @@
|
|||||||
import { defineConfig, splitVendorChunkPlugin } from 'vite'
|
import { defineConfig, splitVendorChunkPlugin } from 'vite'
|
||||||
import { VitePWA } from 'vite-plugin-pwa'
|
import { VitePWA } from 'vite-plugin-pwa'
|
||||||
import solidPlugin from 'vite-plugin-solid'
|
import solidPlugin from 'vite-plugin-solid'
|
||||||
import pkgJSON from './package.json'
|
|
||||||
|
|
||||||
export default defineConfig({
|
export default defineConfig({
|
||||||
base: './',
|
base: './',
|
||||||
build: { chunkSizeWarningLimit: 1000 },
|
build: { chunkSizeWarningLimit: 1000 },
|
||||||
resolve: { alias: { '~': '/src' } },
|
resolve: { alias: { '~': '/src' } },
|
||||||
define: {
|
|
||||||
'import.meta.env.version': JSON.stringify(pkgJSON.version),
|
|
||||||
},
|
|
||||||
plugins: [
|
plugins: [
|
||||||
solidPlugin(),
|
solidPlugin(),
|
||||||
|
|
||||||
splitVendorChunkPlugin(),
|
splitVendorChunkPlugin(),
|
||||||
|
|
||||||
VitePWA({
|
VitePWA({
|
||||||
|
Loading…
Reference in New Issue
Block a user