Open marvinhagemeister opened 8 months ago
I was just trying to figure out a workaround for this, until we get something going in the framework. Any thoughts?
For now, i have settled on managing a second dev.build.ts
file that just doesn't import my handlers, and that seems to be working.
A workaround is to check if Fresh is running in build mode and then skipping the logic. Something like:
if (!Deno.args.includes("build")) {
somethingThatShouldNotRunDuringBuild();
}
Fresh provides fresh.config.ts
file. In side this file you can pass custom configurations. It take onListen callback which triggers when server starts listening.
Connect to remote systems here
The
kv.listenQueue()
function prevents the process from exiting because it waits for messages forever. This breaks the build command.We should probably add something similar to
IS_BROWSER
likeIS_BUILD_MODE
or something so that users can exclude long running stuff from being executed during build.Another approach would be to avoid importing user code during build. Off the top of my head I think we only import user code during build for the manifest generation. Maybe we should replace that with AST-based logic. That way user's don't need to add conditionals or anything to their code.