-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Make datasource imports work with ts-node #2794
Comments
Hey, Please excuse my ignorance but why do you use ts-node? Curious as to the necessity, are you doing something that specifically requires it? |
It's not really necessary, but it makes certain things in development have a quicker feedback loop.
|
Ah like build times with the watch flag? I just use ts-node for scripts like building .env files. Fair dos, I think this'll be low priority until lb4 has feature parity with lb3. |
@bforbis thank you for starting this discussion. I was looking into ts-jest and ts-node recently and discovered a similar problem: by default, LoopBack booters look for I think it would be great to improve LoopBack to support For example, we can modify our CLI templates to use the following naming convention: Thoughts? /cc @strongloop/loopback-maintainers |
@achrinza thank you for the comment. I am going to close this issue as resolved then. |
Currently the
lb4 datasource
command will create a{name}.datasource.ts
file and a{name}.datasource.json
file. Since these files have the same base name, it causes issues with imports while running withts-node
(useful for development). By default,ts-node
will import the JSON file over the TS file, causing datasource construction to fail. For more info on howts-node
works, see TypeStrong/ts-node#769I was able to workaround this issue by manually renaming the json file, but it would be good if the datasource generator didn't create two files with the same base name.
The text was updated successfully, but these errors were encountered: