Fix migrations failing to run in production build
This commit is contained in:
parent
8cebb82bae
commit
ccdef94727
|
@ -1,6 +1,7 @@
|
|||
import { Kysely, Migrator } from 'kysely';
|
||||
import { SQLocalKysely } from 'sqlocal/kysely';
|
||||
import type { Schema } from './schema';
|
||||
import { migrations } from './migrations/';
|
||||
|
||||
const sqlocal = new SQLocalKysely('sticky-notes.db');
|
||||
const kysely = new Kysely<Schema>({ dialect: sqlocal.dialect });
|
||||
|
@ -11,7 +12,10 @@ const migrator = new Migrator({
|
|||
db: kysely,
|
||||
provider: {
|
||||
async getMigrations() {
|
||||
const { migrations } = await import('./migrations/');
|
||||
// TODO: Dynamic import does not work in production build
|
||||
// because the imported chunk imports `sql` from the same
|
||||
// chunk that imports it, so circular dependency. Vite bug.
|
||||
// const { migrations } = await import('./migrations/');
|
||||
return migrations;
|
||||
},
|
||||
},
|
||||
|
|
Loading…
Reference in New Issue