fix(ext): inject versions

This commit is contained in:
Simon
2026-02-02 21:11:23 +08:00
parent 0c3be817c9
commit a834d37f28
2 changed files with 11 additions and 6 deletions

View File

@@ -7,9 +7,8 @@ import { DEMO_API_KEY, DEMO_BASE_URL, DEMO_MODEL } from '@/agent/constants'
import { Button } from '@/components/ui/button'
import { Input } from '@/components/ui/input'
import extPkg from '../../../../package.json'
const CORE_VERSION = extPkg.dependencies['@page-agent/core']
declare const __EXT_VERSION__: string
declare const __CORE_VERSION__: string
interface ConfigPanelProps {
config: LLMConfig | null
@@ -220,10 +219,10 @@ export function ConfigPanel({ config, onSave, onClose }: ConfigPanelProps) {
<div className="flex flex-col items-end">
<span>
Extension <span className="font-mono">v{extPkg.version}</span>
Extension <span className="font-mono">v{__EXT_VERSION__}</span>
</span>
<span>
PageAgent <span className="font-mono">v{CORE_VERSION}</span>
PageAgent <span className="font-mono">v{__CORE_VERSION__}</span>
</span>
</div>
</div>

View File

@@ -1,10 +1,12 @@
import tailwindcss from '@tailwindcss/vite'
import { mkdirSync } from 'node:fs'
import { mkdirSync, readFileSync } from 'node:fs'
import { defineConfig } from 'wxt'
const chromeProfile = '.wxt/chrome-data'
mkdirSync(chromeProfile, { recursive: true })
const pkg = JSON.parse(readFileSync('./package.json', 'utf-8'))
// See https://wxt.dev/api/config.html
export default defineConfig({
srcDir: 'src',
@@ -16,6 +18,10 @@ export default defineConfig({
},
vite: () => ({
plugins: [tailwindcss()],
define: {
__EXT_VERSION__: JSON.stringify(pkg.version),
__CORE_VERSION__: JSON.stringify(pkg.dependencies['@page-agent/core']),
},
optimizeDeps: {
force: true,
},