2023-10-08 22:38:42 +00:00
|
|
|
import { sveltekit } from '@sveltejs/kit/vite';
|
|
|
|
import { defineConfig } from 'vite';
|
|
|
|
|
2024-05-17 03:49:28 +00:00
|
|
|
/** @type {import('vite').Plugin} */
|
|
|
|
const viteServerConfig = {
|
|
|
|
name: 'log-request-middleware',
|
|
|
|
configureServer(server) {
|
|
|
|
server.middlewares.use((req, res, next) => {
|
|
|
|
res.setHeader('Access-Control-Allow-Origin', '*');
|
|
|
|
res.setHeader('Access-Control-Allow-Methods', 'GET');
|
|
|
|
res.setHeader('Cross-Origin-Opener-Policy', 'same-origin');
|
|
|
|
res.setHeader('Cross-Origin-Embedder-Policy', 'require-corp');
|
|
|
|
next();
|
|
|
|
});
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2023-10-08 22:38:42 +00:00
|
|
|
export default defineConfig({
|
2024-05-17 03:49:28 +00:00
|
|
|
plugins: [sveltekit(), viteServerConfig],
|
2024-02-22 01:10:27 +00:00
|
|
|
define: {
|
|
|
|
APP_VERSION: JSON.stringify(process.env.npm_package_version)
|
|
|
|
}
|
2023-10-08 22:38:42 +00:00
|
|
|
});
|