From 854b68467904b5b211062b8425f54f970ad9584d Mon Sep 17 00:00:00 2001 From: wheattoast11 Date: Sat, 30 Nov 2024 15:00:56 -0600 Subject: [PATCH] fix the csp issue --- vite.config.js | 38 +++++++++++++++++++++++++++++++++----- 1 file changed, 33 insertions(+), 5 deletions(-) diff --git a/vite.config.js b/vite.config.js index a0162c8..2cc1d15 100644 --- a/vite.config.js +++ b/vite.config.js @@ -16,12 +16,12 @@ export default defineConfig({ } }, chunkSizeWarningLimit: 1000, - sourcemap: false, + sourcemap: true, minify: 'terser', terserOptions: { compress: { - drop_console: true, - drop_debugger: true + drop_console: false, + drop_debugger: false } } }, @@ -31,6 +31,34 @@ export default defineConfig({ optimizeDeps: { include: ['three', 'framer-motion', 'pts'] }, - publicDir: 'public', - assetsInclude: ['**/*.png', '**/*.ico', '**/*.webmanifest'] + server: { + headers: { + 'Content-Security-Policy': ` + default-src 'self'; + script-src 'self' 'unsafe-inline'; + style-src 'self' 'unsafe-inline'; + img-src 'self' data: blob:; + font-src 'self'; + object-src 'none'; + base-uri 'self'; + form-action 'self'; + frame-ancestors 'none'; + `.replace(/\s+/g, ' ').trim() + } + }, + preview: { + headers: { + 'Content-Security-Policy': ` + default-src 'self'; + script-src 'self' 'unsafe-inline'; + style-src 'self' 'unsafe-inline'; + img-src 'self' data: blob:; + font-src 'self'; + object-src 'none'; + base-uri 'self'; + form-action 'self'; + frame-ancestors 'none'; + `.replace(/\s+/g, ' ').trim() + } + } }); \ No newline at end of file