-
Notifications
You must be signed in to change notification settings - Fork 3
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
bug: unable to use local pathed modules in config file. #45
Comments
Hey there @jaymanmdev! Thanks so much for the kind words and super detailed bug report, it's a huge help. This is a great catch and a good use case, and luckily an easy fix. Can you give If so, I can release this isolated fix on short order. Thanks! |
@sjc5 I upgraded to EDIT: I can confirm that the issue is fixed (I had it set up incorrectly.). Thankyou so much! Woohoo! |
Re: the new error:Ah, I think I know what that may be (sorry, I pushed this attempted fix quickly and it's mixed in with some other prior experimentation). Can you:
Re: the fix for the original issue:Before we were just checking to see if the config file were a JS or TS file. If JS, we just read it raw, and if TS, we ran it through a So to support this use case (which is great), instead we can just use |
I can confirm that the issue has been fixed and I can use modules inside the config file now. No issues here anymore. I am using However, I do wonder if changing the architecture to initiate the watcher in the Cheers! |
Nice! Thanks for confirming. Also thanks for the tip on Deno, I'll take a look when I get some time. The Deno setup is definitely weirder and more brittle. Can you clarify if there's a use case or convenience reason you'd rather set the dev server port in your main server entry? Usually that is something that is set in a background For a little background, one reason that it is difficult to put too much of the dev server code into your main server entry is that a lot of the watcher-related stuff requires Node APIs, and it can cause errors when bundling for non-Node targets. It also can get a little trickier architecturally if your watchers are initiated in your main entry file. You sort of lose control over the lifecycle needed to make browser refresh work, because if the main entry file gets restarted, you lose any reference you had to which browser tabs you had open for server-sent events (or you'd need to write them to a file, which is tricky and also not possible for some non-Node targets). As far as the server instance itself, that is kind of runtime dependent too. Some of them will "just work" if you All of that said, if there's a specific use case that isn't being covered now, or the current architecture is blocking anything, I'd love to find a way to at minimum provide an escape hatch. Let me know what you think! |
I'll have more of a think about all of this! and update you if I think of anything. I wouldn't mind contributing some code at some point and see if I can get involved with this project as I am getting pretty invested in Hwy now! - I do agree that the way it is designed right now is probably the best way forward as a platform agnostic, and more flexible approach. I've now set up my environment variable validation logic in a pretty neat way once you fixed the issue I was having and things are playing together VERY nicely so that's good. I'm currently in the early process of working on a Pokemon Roundest by Theo (Ping.gg) clone (https://faster-round.t3.gg) using Hwy. He used NextJS initially and then Astro for his version so I'm gonna be using Hwy entirely, so Hono, HTMX, Node, probably Turso and SQLite for data storage and probably Fly.io or something similar as a deployment target. It'll be fun to get this up and running! |
Sounds awesome, and yes, it would be great to have some more folks familiar with the code base and able to help out! Let me know if you hit any other issues with the Pokemon clone. Unfortunately our docs are a little bit out of date as well, so make sure you read through the last several release notes to fill in any gaps. I plan to make the docs a lot simpler / faster to update soon, and of course get them up to date with all the latest APIs. That might be a good place to start diving into contributing, perhaps. Looking forward to checking out your clone once it's done, sounds like a cool stack. |
public/dist & dist errorNice catch on the regression when you delete the fetch issue in different node versionsHave any more info on the fetch issue / disparity between Node versions? Is this fetches coming from within your app, or is it the dev server? The browser reloading uses an RPC of sorts, and there are some known issues on certain versions of Node where there is some goofiness with |
@sjc5 I am at the movies with my girlfriend at the moment so I'll give it a try later on this afternoon, and let you know if beta 12 fixes the issue. |
Do you know what the rate limit is for the API you're hitting? Feels like rate limiting to me, especially seeing the 'Promise.allSettled' |
It only seems to be happening every so often right now so I'll continue to monitor it and see how things go. Also, I have managed to get |
It's possible it's the opposite problem and they actually should be rate limiting 😅 |
Sorry I'm on mobile and completely missed your last paragraph @jaymanmdev. Yeah would love to see a repo with that done or a PR if it's simple. If it requires a lot of changes let's discuss it in a new issue and maybe start with an example repo. |
Yeah, I have a feeling they receive too much traffic - if that is what I have to deal with for now, I'll deal. I'll probably create an internal cache on the server in the future since the API doesn't really change very much.
Alrighty, sounds good! We can create a separate issue for this in a bit - It is very simple right now. It just extends the |
@sjc5 we can close this issue now. :) I'm going to make my repository public for my Pokemon app now so if you'd like to take some time to skim around it and give me any suggestions, that'd be great. I'm still new to HTMX so I'm not sure about best practices and stuff. I'd love some suggestions. :) (the dev branch is the up to date one.) |
Hey there! I am ABSOLUTELY LOVING hwy! This framework is what I have been waiting for! I can't wait to see where it goes in the future!
I have encountered a little bit of an issue. I am looking to validate my environment variables in the configuration file so that if they are not valid then I don't proceed with the config start-up. However, I get the following error when trying to use a module within the configuration file:
If I pull in the source from the module and use it, it all works fine - npm modules work fine, it is just local modules that don't. It seems like it is resolving it from the
dist
directory, using the built configuration file. This behaviour bug really only affects development as in production you won't need the hmr browser watcher etc. As theport
option in the config is used as the port for the watcher, I currently cannot validate my env, pass it to the configport
option and have hmr/reload working properly. I get the following error if I try to reload this way (saving a file in dev, triggering the watcher):As you can see, the watcher is trying to connect/make a request to port 3000 (the default) even though the server is running through port 8000 based on my env variables. I can think of two possible fixes we can make to alleviate this at the moment.
hwy.config.ts
file in the root of the project and resolve modules properly, rather than reading the built config file indist
.^^^ Pass the port into
hwyInit
and start the watcher at that point since this is processed before the server starts anyways. I understand that themain.tsx
file is reloaded with the watcher, so maybe this isn't possible without some major reorganization of the server entrypoint?Thanks heaps!
The text was updated successfully, but these errors were encountered: