mirror of
https://github.com/khrysse/khrysse.github.io.git
synced 2025-06-27 14:41:54 +00:00
Update vite.config.js
This commit is contained in:
parent
18e64374a9
commit
3caf6ef6e7
@ -1,12 +1,26 @@
|
|||||||
import tailwindcss from '@tailwindcss/vite';
|
import tailwindcss from '@tailwindcss/vite';
|
||||||
import { sveltekit } from '@sveltejs/kit/vite';
|
import { sveltekit } from '@sveltejs/kit/vite';
|
||||||
import { defineConfig } from 'vite';
|
import { defineConfig } from 'vite';
|
||||||
|
import { readFile } from 'fs/promises';
|
||||||
|
import { fileURLToPath } from 'url';
|
||||||
|
import { dirname, resolve } from 'path';
|
||||||
|
|
||||||
|
const __dirname = dirname(fileURLToPath(import.meta.url));
|
||||||
|
const pkgPath = resolve(__dirname, 'node_modules/vite/package.json');
|
||||||
|
|
||||||
|
const vitePkgRaw = await readFile(pkgPath, 'utf-8');
|
||||||
|
const viteVersion = JSON.parse(vitePkgRaw).version;
|
||||||
|
|
||||||
|
const sveltekitPkg = await import('@sveltejs/kit/package.json', {
|
||||||
|
assert: { type: 'json' }
|
||||||
|
});
|
||||||
|
const sveltekitVersion = sveltekitPkg.default.version;
|
||||||
|
|
||||||
export default defineConfig({
|
export default defineConfig({
|
||||||
plugins: [tailwindcss(), sveltekit()],
|
plugins: [tailwindcss(), sveltekit()],
|
||||||
define: {
|
define: {
|
||||||
__APP_MODE__: JSON.stringify(process.env.MODE),
|
__APP_MODE__: JSON.stringify(process.env.MODE),
|
||||||
__VITE_VERSION__: JSON.stringify(require('vite/package.json').version),
|
__VITE_VERSION__: viteVersion,
|
||||||
__SVELTEKIT_VERSION__: JSON.stringify(require('@sveltejs/kit/package.json').version)
|
__SVELTEKIT_VERSION__: JSON.stringify(sveltekitVersion)
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
Loading…
x
Reference in New Issue
Block a user