aidenwallis / kysely-d1

D1 dialect for Kysely
MIT License
206 stars 12 forks source link

Using D1Dialect causes worker tests to fail - Cannot use require() to import an ES Module. #27

Open Suman085 opened 4 months ago

Suman085 commented 4 months ago

Initializing D1Dialect causes my tests to not run as expected.

    private async initializeDb(db: D1Database) {
        this.db = new Kysely<Database>({
            dialect: new D1Dialect({ database: db }),
        });
    }

image

Happy to help...

NoxHarmonium commented 1 week ago

I just ran into this issue using vitest. This is due to lack of an ESM module in the published NPM package. It is fixed in https://github.com/aidenwallis/kysely-d1/pull/25 but hasn't been published to NPM yet. I've published a temporary fork to unblock what I was working on at "@noxharmonium/kysely-d1@0.4.0" if anyone want's to use that in the meantime.

@aidenwallis Let me know if you need any help with getting a new release out. If it is blocked due to some outstanding bugs I could try and have a look.