From 88946de1192fd6a506d61fdf54b0758babd4c8d0 Mon Sep 17 00:00:00 2001 From: dskvr Date: Thu, 18 Apr 2024 03:10:19 +0200 Subject: [PATCH] revert configs back to working versions --- package.json | 19 +++++++------------ svelte.config.js | 29 +++-------------------------- vite.config.ts | 34 ++++++++++++++++------------------ 3 files changed, 26 insertions(+), 56 deletions(-) diff --git a/package.json b/package.json index c0bdb71..951b0d4 100644 --- a/package.json +++ b/package.json @@ -1,15 +1,15 @@ { "name": "myrelay.site", "type": "module", - "version": "0.2.0", + "version": "0.1.1", "main": "index.js", "repository": "git@github.com:sandwichfarm/myrelay.site.git", "author": "dskvr ", "license": "MIT", "scripts": { "dev": "vite dev", - "build": "pnpm prepare && vite build", - "prepare": "pnpm build:themes", + "build": "yarn prepare && vite build", + "prepare": "yarn build:themes", "preview": "vite preview", "check": "svelte-check --tsconfig ./tsconfig.json", "check:watch": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json --watch", @@ -40,7 +40,6 @@ "nostr-zap": "0.22.0", "object-hash": "3.0.0", "paneforge": "0.0.2", - "postcss-import": "16.1.0", "promise-deferred": "2.0.4", "svelte": "4.2.12", "svelte-geolocation": "0.3.0", @@ -55,7 +54,8 @@ "tailwind-variants": "0.2.1", "tseep": "1.2.1", "vaul-svelte": "0.3.0", - "vite": "5.2.9", + "vite-plugin-mkcert": "1.17.5", + "vitest": "1.4.0", "zod": "3.22.4" }, "devDependencies": { @@ -72,11 +72,6 @@ "svelte-check": "3.6.9", "tailwindcss": "^3.3.6", "typescript": "5.4.3", - "vite-plugin-dynamic-import": "1.5.0", - "vite-plugin-mkcert": "1.17.5", - "vitest": "1.4.0" - }, - "engines": { - "node": ">=18.0.0" + "vite-plugin-dynamic-import": "1.5.0" } -} +} \ No newline at end of file diff --git a/svelte.config.js b/svelte.config.js index e265959..963f9bc 100644 --- a/svelte.config.js +++ b/svelte.config.js @@ -1,4 +1,3 @@ -import { sveltekit } from "@sveltejs/kit/vite"; import { vitePreprocess } from "@sveltejs/vite-plugin-svelte"; import adapter from "@sveltejs/adapter-static"; import preprocess from "svelte-preprocess"; @@ -24,30 +23,8 @@ export default { files: () => ["src/service-worker.js"], }, alias: { - "$lib": "./src/lib", - "$lib/*": "./src/lib/*", + $lib: "./src/lib", "@/*": "./src/lib" - }, - }, - vite: { - // server: { - // headers: { - // 'Cross-Origin-Opener-Policy': 'unsafe-none', - // 'Cross-Origin-Embedder-Policy': 'unsafe-none', - // 'Cross-Origin-Resource-Policy': "cross-site" - // } - // }, - plugins: [sveltekit()], - build: { - rollupOptions: { - output: { - manualChunks: (id) => { - if (id.includes('node_modules')) { - return 'vendor'; // Split vendor code - } - } - } - } } - } -}; + }, +}; \ No newline at end of file diff --git a/vite.config.ts b/vite.config.ts index eee814a..2f50e91 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -4,32 +4,29 @@ import mkcert from 'vite-plugin-mkcert' import { readFileSync } from 'fs'; import { fileURLToPath } from 'url'; - const file = fileURLToPath(new URL('package.json', import.meta.url)), json = readFileSync(file, 'utf8'), pkg = JSON.parse(json); - -// /** @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", "cross-origin"); -// res.setHeader("Cross-Origin-Embedder-Policy", "unsafe-none"); -// res.setHeader("Cross-Origin-Resource-Policy", "cross-origin"); -// next(); -// }); -// } -// }; +/** @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(); + }); + } +}; export default defineConfig({ plugins: [ sveltekit(), mkcert(), - // viteServerConfig + viteServerConfig ], test: { include: ["src/**/*.{test,spec}.{js,ts}"], @@ -38,5 +35,6 @@ export default defineConfig({ version: { value: pkg.version, } - } + }, + debug: true }); \ No newline at end of file