New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Typescript support for migration files #705
Comments
Migrations currently work only based on actual files in the migrations folder, which is not compatible with webpack. Not a webpack user myself, and I am not aware of any workaround currently. Check out this repo, it uses different way for migrations, which should be compatible with webpack: https://github.com/thekevinbrown/express-ts-webpack-example-app |
This allows using migrations with webpack. Related: #705
Latest RC of v4 supports passing list of migrations in the configuration, which is compatible with webpack: https://mikro-orm.io/docs/next/migrations#importing-migrations-statically |
So from what I understand, you would like to use TS migrations but execute them in the bundled code. That will never work, unless you register ts-node there, which is hardly what you want. So to your first question, use JS migrations - if you would like to have TS migrations, you will need to compile them first and adjust the Btw I see you are using Your second error is pretty much connected to what you are trying -- if you want to bundle everything, you need to use the Will close this now, as tbh I am a bit tired of issues where I talk to myself only... |
Hi @B4nan
I'm trying to add mikro-orm to my project. I use it with an electron and react.
And I have a few problems with migrations. I use them programmatically.
I created a reproduction repository so you can take a look. To start application use
npm run dev
.Looks like these problems are about with webpack configuration, not mikro-orm itself
It works well when migration file was written in JS only. When I use typescript then an error occurs:
This problem seems to be similar to this one.
First commit JS syntax is used for migration file.
Second commit TS syntax is used for migration file
I think this problem is about webpack configuration but I'm stuck with it. I would really appreciate it if you could give me some advice on this)
When I use webpack with
production
mode it create application bundle indist
folder. When I executenpm run start
script error occursThere are no migration file at runtime and I have no idea how to add it(
Versions
The text was updated successfully, but these errors were encountered: