I'm trying to setup PGLite in my typeorm project for testing. I'm using jest + SWC. The error that I'm getting is
({"Object.<anonymous>":function(module,exports,require,__dirname,__filename,jest){import { d as PGliteInterface } from '../pglite-CCwqaSmq.js';
^^^^^^
SyntaxError: Cannot use import statement outside a module
The setup
import * as uuid_ossp from '@electric-sql/pglite/dist/contrib/uuid_ossp';
import { TypeOrmModule } from '@nestjs/typeorm';
import { PGliteDriver } from 'typeorm-pglite';
console.log(uuid_ossp);
export const getRootTypeormModule = () => {
return TypeOrmModule.forRoot({
type: 'postgres',
driver: new PGliteDriver({ extensions: { uuid_ossp: uuid_ossp.uuid_ossp } })
.driver,
});
};
and that error goes away but the import is an empty object
seems kind of an issue of ESmodule , but after a long time I didn't find the issue and not sure if it's up to me or some misconfiguration in the packages.
Hey,
Version:
@electric-sql/pglite": "^0.2.14
I'm trying to setup PGLite in my typeorm project for testing. I'm using jest + SWC. The error that I'm getting is
The setup
This is my tsconfig
SWC config
Dont know why I need to import the uuid extensions from
/dist
(this is not what's shown in the docs)Also, I tried to add this to jest config
and that error goes away but the import is an empty object
seems kind of an issue of ESmodule , but after a long time I didn't find the issue and not sure if it's up to me or some misconfiguration in the packages.
Any clue?
Thanks in advance