-
Notifications
You must be signed in to change notification settings - Fork 38
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
TypeORM connection fails due to SyntaxError #1
Comments
Hi @Swiftb0y thanks for contributing. Thanks in advance |
Of course. What Solution do you prefer? |
I believe that Solution 2 would be nice. What do you think? |
I need to look into the details a bit more but I think it's possible without too much hassle. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Currently, running the code outside of
ts-node
results in aSyntaxError: Cannot use import statement outside a module
because theormconfig.js
is pointing at thesrc
dir when specifying the typeorm entities ("entities": ["src/**/**/**.entity{.ts,.js}"],
). This only works from withints-node
. There are two solutions to the problem:Solution 1
just replace the
src
withdist
. Pro: Simple, minimal change required; Con: requires rebuild when entities are changed.Solution 2
Convert ormconfig.json to typescript module and construct path conditionally.
detection via TypeStrong/ts-node#846. Pro: more solid approach, doesnt suffer from the Con from solution 1; Con: more complicated, requires bleeding edge version of ts-node, ts-node specific solution.
The text was updated successfully, but these errors were encountered: