denoland / fresh

The next-gen web framework.
https://fresh.deno.dev
MIT License
12.59k stars 650 forks source link

Deno build not building tailwind styles #2729

Open aLemonFox opened 3 weeks ago

aLemonFox commented 3 weeks ago

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?

Task start deno run -A main.ts build
No pre-compiled tailwind styles found.
Did you forget to run "deno task build" prior to starting the production server?
marvinhagemeister commented 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.

aLemonFox commented 3 weeks ago

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.

aLemonFox commented 3 weeks ago

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.

marvinhagemeister commented 3 weeks ago

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.