fix: stabilize frontend preferences namespace
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
import { defineConfig } from '@vben/vite-config';
|
||||
|
||||
import { readFileSync } from 'node:fs';
|
||||
import { fileURLToPath, URL } from 'node:url';
|
||||
|
||||
import ElementPlus from 'unplugin-element-plus/vite';
|
||||
@@ -8,6 +9,9 @@ import { loadEnv } from 'vite';
|
||||
const resolveLocal = (path: string) =>
|
||||
fileURLToPath(new URL(path, import.meta.url));
|
||||
const appDir = fileURLToPath(new URL('.', import.meta.url));
|
||||
const appVersion =
|
||||
JSON.parse(readFileSync(resolveLocal('./package.json'), 'utf-8')).version ||
|
||||
'0.0.0';
|
||||
|
||||
const exactAlias = (find: string, path: string) => ({
|
||||
find: new RegExp(`^${find.replaceAll('/', '\\/')}$`),
|
||||
@@ -30,6 +34,9 @@ export default defineConfig(async (config) => {
|
||||
build: {
|
||||
modulePreload: false,
|
||||
},
|
||||
define: {
|
||||
'import.meta.env.VITE_APP_VERSION': JSON.stringify(appVersion),
|
||||
},
|
||||
resolve: {
|
||||
alias: [
|
||||
exactAlias(
|
||||
|
||||
Reference in New Issue
Block a user