Skip to content

Commit 39ff9d9

Browse files
authored
Merge pull request #2 from CNAG-Biomedical-Informatics/codex/configure-vite-server-fs-allow-for-sqlite-query
Fix worker path for Vite
2 parents 8c43845 + 28606e0 commit 39ff9d9

File tree

1 file changed

+14
-3
lines changed

1 file changed

+14
-3
lines changed

vite.config.js

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,21 @@
1-
import { defineConfig } from 'vite'
2-
import { svelte } from '@sveltejs/vite-plugin-svelte'
3-
import { fileURLToPath, URL } from 'node:url';
1+
import { defineConfig } from 'vite';
2+
import { svelte } from '@sveltejs/vite-plugin-svelte';
3+
import { fileURLToPath } from 'node:url';
4+
import { dirname } from 'node:path';
5+
import { createRequire } from 'node:module';
6+
7+
const require = createRequire(import.meta.url);
8+
const workerDir = dirname(require.resolve('sql.js-httpvfs/dist/sqlite.worker.js'));
9+
const projectRoot = fileURLToPath(new URL('.', import.meta.url));
410

511
// https://vitejs.dev/config/
612
export default defineConfig({
713
plugins: [svelte()],
14+
server: {
15+
fs: {
16+
allow: [projectRoot, workerDir],
17+
},
18+
},
819
// resolve: {
920
// alias: {
1021
// '@muonw/powertable': fileURLToPath(new URL('./node_modules/@muonw/powertable/index.js', import.meta.url))

0 commit comments

Comments
 (0)