Aliheym / typeorm-transactional

A Transactional Method Decorator for TypeORM that uses Async Local Storage or cls-hooked to handle and propagate transactions between different repositories and service methods.
MIT License
213 stars 28 forks source link

SyntaxError: Cannot use import statement outside a module #32

Open Serg890 opened 1 year ago

Serg890 commented 1 year ago

The project starts and works, but when I run the migration I get the following error.

Also, I tried deleting the Post.entity.ts file from node modules and it works correctly but it's not quite correct to change.

How can I fix it?

**\node_modules\typeorm-transactional\tests\entities\Post.entity.ts:1

"import { Entity, PrimaryGeneratedColumn, Column } from 'typeorm'; ^^^^^^

SyntaxError: Cannot use import statement outside a module

export const dataSource = new DataSource({
  logging: false,
  type: "postgres",
  host: process.env.TYPEORM_HOST,
  port: parseInt(process.env.TYPEORM_PORT),
  username: process.env.TYPEORM_USERNAME,
  password: process.env.TYPEORM_PASSWORD,
  database: process.env.TYPEORM_DATABASE,
  synchronize: false,
  entities: [join(__dirname, '**', '*.entity.{ts,js}')],
  migrations: [join(__dirname, "src", "migrations", "*.ts")],
  migrationsRun: true,
});
msanandrea commented 4 months ago

@Serg890 same to me. Deleted the tests folder and worked. Any definitive solution for this?