* include new image assets in static/photos * define __PHOTO_FILES__ for dynamic photo URLs * update package.json and package-lock.json with @types/node
32 lines
919 B
TypeScript
32 lines
919 B
TypeScript
import { readdirSync } from 'node:fs';
|
|
import tailwindcss from '@tailwindcss/vite';
|
|
import adapter from '@sveltejs/adapter-static';
|
|
import { sveltekit } from '@sveltejs/kit/vite';
|
|
import { defineConfig } from 'vite';
|
|
|
|
// Background photos live in static/photos so Vite copies them verbatim
|
|
// (original filenames, no content hash) instead of running them through the
|
|
// module asset pipeline.
|
|
const photoFiles = readdirSync('static/photos').filter((name) =>
|
|
/\.(jpe?g|png)$/i.test(name)
|
|
);
|
|
|
|
export default defineConfig({
|
|
server: {
|
|
fs: { allow: ['assets'] }
|
|
},
|
|
define: {
|
|
__PHOTO_FILES__: JSON.stringify(photoFiles)
|
|
},
|
|
plugins: [
|
|
tailwindcss(),
|
|
sveltekit({
|
|
compilerOptions: {
|
|
// Force runes mode for the project, except for libraries. Can be removed in svelte 6.
|
|
runes: ({ filename }) => filename.split(/[/\\]/).includes('node_modules') ? undefined : true
|
|
},
|
|
adapter: adapter()
|
|
})
|
|
]
|
|
});
|