Skip to content

web search done right

move captcha images/audio to correct location during build

Mikkel Denker9d0dba7da25d
diff --git a/frontend/package.json b/frontend/package.json
index ddd52fc1..c7801589 100644
--- a/frontend/package.json
+++ b/frontend/package.json
@@ -45,6 +45,7 @@
"prettier": "^3.1.1",
"prettier-plugin-svelte": "^3.1.2",
"prettier-plugin-tailwindcss": "^0.5.9",
+ "rollup-plugin-copy": "^3.5.0",
"svelte": "^4.2.8",
"svelte-check": "^3.6.2",
"svelte-highlight": "^7.4.6",
diff --git a/frontend/vite.config.ts b/frontend/vite.config.ts
index ab769d10..a37ee8b7 100644
--- a/frontend/vite.config.ts
+++ b/frontend/vite.config.ts
@@ -4,6 +4,9 @@ import Icons from 'unplugin-icons/vite';
import wasm from 'vite-plugin-wasm';
import topLevelAwait from 'vite-plugin-top-level-await';
import wasmPack from './src/wasm-pack-plugin';
+import copy from 'rollup-plugin-copy';
+import path from 'path';
+import { normalizePath } from 'vite';
export default defineConfig({
plugins: [
@@ -14,6 +17,19 @@ export default defineConfig({
topLevelAwait(),
sveltekit(),
Icons({ compiler: 'svelte' }),
+ copy({
+ targets: [
+ {
+ src: normalizePath(path.resolve(__dirname, './src/lib/captcha/images')),
+ dest: normalizePath(path.resolve(__dirname, './build/server/chunks')),
+ },
+ {
+ src: normalizePath(path.resolve(__dirname, './src/lib/captcha/audio')),
+ dest: normalizePath(path.resolve(__dirname, './build/server/chunks')),
+ },
+ ],
+ hook: 'closeBundle',
+ }),
],
test: {
include: ['src/**/*.{test,spec}.{js,ts}'],