Closed Mauro-Domingues closed 8 months ago
@Mauro-Domingues I'm still encountering this issue on version 1.8.8, where is the fix for this?
@Mauro-Domingues I'm still encountering this issue on version 1.8.8, where is the fix for this?
I closed my issue due to inactivity
You can avoid this bug by using ${'from'} if you're using templates like me
export class CreateDataSource {
public execute(): string {
return `import { DataSource } ${'from'} 'typeorm';
`;
}
}
If it's node packages, I solved it by putting the node prefix node:
import { something } from 'crypto';
to:
import { something } from 'node:crypto';
As for the rest, unfortunately there is still no solution.
@Mauro-Domingues really appreciate the reply and this is a great workaround, can't believe I didn't think of it!
I have a cli which helps to build fast apis, and inside of it some typescript templates, but is resolving those imports.
Steps to Reproduce:
export const AppDataSource = new DataSource({ type: 'mysql', host: process.env.DB_HOST, port: Number(process.env.DB_PORT), username: process.env.DB_USER, password: process.env.DB_PASSWORD, database: process.env.NODE_ENV === 'test' ? 'database_test' : process.env.DB_DATABASE, // synchronize: true, // logging: true, entities: [`\${dirname}/../../modules/*/entities/.{js,ts}`], // subscribers: [], migrations: [`\${dirname}/migrations/*.{js,ts}`], }); `; } }