PetJournal / petjournal.api

API of the Pet Journal platform that helps you take care of your pet.
MIT License
15 stars 6 forks source link

Fix/dev script #45

Closed matheusgondra closed 10 months ago

matheusgondra commented 11 months ago

The "dev" script had a problem: it only worked if the "build" script had been run first. This problem occurred because of the import alias. Sucrase, which we used to run the code, was unable to resolve imports using the import alias.

To solve the problem, I found the tsconfig-paths package, which solves this import alias problem in typescript.

src/main/server.ts

import './config/module-alias'
import `tsconfig-paths/register` // adding the package
import app from '@/main/config/app'
import env from '@/main/config/env'

app.listen(env.port, () => { console.log(`Server running at http://localhost:${env.port}`) })