Open aLemonFox opened 3 weeks ago
The main.ts
file is the one you use to startup your production server. It doesn't do anything with the arguments passed to it. So it makes no difference if you pass build
or other strings to it.
To build your fresh application, pass build
to dev.ts
like so: deno run -A dev.ts build
.
Hey, thanks for your reply. I see, but I thought dev.ts
was supposed to be the root for loading dev configs (if needed). Why would the "default" start command be deno run -A main.ts
and the build command be for dev.ts
? It both starts the server.
edit: nevermind, the last part is incorrect. This was because I had a setup in the dev.ts
file that subscribes to a remote api. This gave the impression the server started.
This is a bit off topic but then where do we put initialization of the app if it cannot be done in dev.ts
with AOT builds? Since the build command in my case also fires the config setup, which locks the command as it keeps listening to incoming messages. And if I put it in main.ts
only it is not fired when using the watch command deno run -A --watch=static/,routes/ dev.ts
.
To make code run in both dev and prod mode you can use a shared file that you import in both main.ts
and dev.ts
.
Hi, I have a fresh app on Digital Ocean and setup the configs for ahead of time builds. However it does not seem to work for the production version for some reason. Is it not possible to build from
main.ts
?