-
-
Notifications
You must be signed in to change notification settings - Fork 428
Move error handling into pages #91
Comments
A related thought. Currently, It turns out that's not ideal for a few reasons. Firstly, it's slightly confusing that So I'd like to experiment with a different, simpler structure:
I think that would be a little more intuitive than the status quo, and might yield benefits in terms of startup performance (for Lambda-type environments). There'd be some gotchas to work through though, e.g. we don't want to accidentally bundle |
Nextjs is now has Universal Webpack feature https://zeit.co/blog/next5. I think we can also simplify webpack configuration by using a similar feature. |
It would be great if some sort of configurability/composability would be given to the service worker. One might want to extend it with custom behaviour/code/functions. Maybe this could be limited to es6+ and then be done with rollup (and a simple config thereof)? |
Been thinking about this a little further. I think we probably should have a separate service worker webpack config (which would be optional, since not everyone wants a service worker), in which case it'd make sense to have a structure like this:
Also, I'd like to get rid of the magically-injected
Not totally happy with the naming of |
@Rich-Harris I know with SSR the client and the server have the appearance of being the same thing, but I generally like a separation of files/concerns when it comes to back end and front end. So often in my folder structures I'll have something like:
Otherwise you end up with Rails-like structures of massive folder lists in the main root. Just a thought. Arguably |
I personally don't like directory based routing. It would be great If we can define routes with code. Workbox https://developers.google.com/web/tools/workbox/ can be used for service worker generation. |
@ansarizafar Routing is a little off topic for this thread ;) but I think the conversation about this in the past has mainly revolved around allowing both to be possible. For new developers who don't understand the intricacies of coded routing (and lets be honest, they are sometimes difficult to code), out-of-the-box page-based routing can be a beautiful thing. I favor keeping it, but having the ability to add on with more complex routing if so desired. |
I like the idea of having the generated files available for insight. I was however confused by the naming. I first expected What about collapsing the generated folder into a file?
Should client/server/sw get different generated data? (Alternative name propsal: |
@arxpoetica I can see the appeal of that. Main reason I've avoided it thus far is a) I'm likely to have some (non-route-specific) code that is shared between server and client, and I don't want to have a third import someutil from '../universal/someutil'; ...and b) the [client|server|service-worker].js files are often quite small. But I definitely get where you're coming from. Lemme think on that. (Also, it might turn out that we can make that entirely a matter of choice.)
Then Sapper might not be the framework for you! @thgh I really like the 'manifest' name, that's much better than 'generated' 👍 — thank you. I considered putting everything in a single file. The |
@Rich-Harris I see your point. One problem that a lot of people have (for example) with isomorphic apps is this kind of blurring of the lines. Maybe the right thing to do then (against my own better judgement, ha) is to thoroughly or deliberately embrace that blurring, i.e., Sapper is truly trying to straddle that line because it does it really, really well. I admit I'm not 100% convinced of this argument, but it seems worthy/aspirational. Of note, Meteor tried to straddle this line and had oodles of lovers and haters. But it also had the problem of boxing people in to strict convention. Sapper ("lovingly") tries to step out of the way and only has a few "right" opinions, lol. For example, on my end I already have a client and server folder as needed and it doesn't harm Sapper in any way and it doesn't harm me, so things seem to be working just fine. I mostly just need to wrap my brain around it all. Like you said, my brain is going to be thinking on it too, but I think it's perfectly fine as you have it above, i.e., all under |
This stuff was all implemented in 0.7, so this can be closed. Re project structure, it should be fairly straightforward to make it entirely configurable, though for now it expects the structure laid out above (since configurability has its own costs, in that it adds to the list of things developers have to worry about) |
...and out of templates. Great idea from @mrkishi — if our
routes
directory had4xx.html
and5xx.html
(or more specific codes, not that we're currently set up to use them) files, then we could use those in place of the currenttemplates/xxx.html
files. This has a number of advantages:templates/page.html
It would also simplify the internals slightly.
The text was updated successfully, but these errors were encountered: