Pointing to migrations folder creates an import error
Author: alperCreated Feb 20, 2024Updated Sep 23, 2026
Labelsbug
Issue description
Pointing to migrations folder creates an import error
Expected Behavior
I finally managed to generate a migration. To be able to run it I need to put it in the migrations property.
If I do it like this:
migrations: ['./src/migrations/*.ts'],then I get this error on starting nest:
SyntaxError: Cannot use import statement outside a moduleI don't get the error if I put it in like this:
migrations: ['dist/migrations/*.js'],Actual Behavior
I'd like it to work with just the typescript migrations I just generated.
Steps to reproduce
Put the wrong thing in the migrations setting.
My Environment
| Dependency | Version |
|---|---|
| Operating System | macOS |
| Node.js version | 18.17.1 |
| Typescript version | 4.9.5 |
| TypeORM version | latest |
Additional Context
No response
Relevant Database Driver(s)
- aurora-mysql
- aurora-postgres
- better-sqlite3
- cockroachdb
- cordova
- expo
- mongodb
- mysql
- nativescript
- oracle
- postgres
- react-native
- sap
- spanner
- sqlite
- sqlite-abstract
- sqljs
- sqlserver
Are you willing to resolve this issue by submitting a Pull Request?
No, I don’t have the time and I’m okay to wait for the community / maintainers to resolve this issue.
Source: typeorm/typeorm