Skip to content
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

Importing EntityManager fails when using webpack #57

Closed
sayav opened this issue Feb 20, 2022 · 6 comments
Closed

Importing EntityManager fails when using webpack #57

sayav opened this issue Feb 20, 2022 · 6 comments
Assignees
Labels
bug Something isn't working

Comments

@sayav
Copy link

sayav commented Feb 20, 2022

Describe the bug
I've got an issue with webpack not being able to dynamically import '@mikro-orm/knex' or '@mikro-orm/mongodb' in the whenModuleAvailable function. Since these are imported as enums (e.g. import(EntityManagerModuleName.Knex)) webpack does not bundle these modules. It's possible to fix this by importing with strings import("@mikro-orm/knex"). I can write a pull request if this would help :)

Versions

Dependency Version
node 14
typescript 4.1.6
mikro-orm 5.x
@sayav sayav added the bug Something isn't working label Feb 20, 2022
@B4nan
Copy link
Member

B4nan commented Feb 20, 2022

Feel free to PR this, this particular piece of code also came from someone else, I don't really like that enum there anyway.

@B4nan
Copy link
Member

B4nan commented Feb 20, 2022

Will you have time for this during today? I'd like to ship v5 in few hours, will be happy to look into it myself right now, if you haven't started already.

@sayav
Copy link
Author

sayav commented Feb 20, 2022

I can have it done today for sure

@B4nan
Copy link
Member

B4nan commented Feb 20, 2022

Already started, so will push what I have in a minute and feel free to improve on that :]

@sayav
Copy link
Author

sayav commented Feb 20, 2022

Oh sorry I missed that message. Feel free to look at the pull request.

@B4nan B4nan closed this as completed in 47f56ff Feb 20, 2022
@B4nan
Copy link
Member

B4nan commented Feb 20, 2022

I see we ended up with quite similar approach, mine being a less verbose I guess.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants