diff --git a/tsconfig.node.json b/tsconfig.node.json index 424084a..64b26eb 100644 --- a/tsconfig.node.json +++ b/tsconfig.node.json @@ -1,6 +1,6 @@ { "extends": "@vue/tsconfig/tsconfig.node.json", - "include": ["vite.config.*", "vitest.config.*", "cypress.config.*", "playwright.config.*"], + "include": ["vite.config.*", "vitest.config.*", "cypress.config.*", "playwright.config.*", "package.json"], "compilerOptions": { "composite": true, "types": ["node"] diff --git a/vite.config.ts b/vite.config.ts index cd52dc8..36df33a 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -1,15 +1,27 @@ import { fileURLToPath, URL } from 'node:url' +import { writeFileSync } from 'node:fs' import { defineConfig } from 'vite' import vue from '@vitejs/plugin-vue' import vueJsx from '@vitejs/plugin-vue-jsx' +import packageJson from './package.json' // https://vitejs.dev/config/ export default defineConfig({ base: process.env.NODE_ENV === 'production' ? '/openpose_editor/' : '/', - plugins: [vue(), vueJsx()], + plugins: [ + vue(), + vueJsx(), + { + name: 'create-version-file', + apply: 'build', + writeBundle() { + writeFileSync('dist/version.txt', packageJson.version); + }, + } + ], resolve: { alias: { '@': fileURLToPath(new URL('./src', import.meta.url))