Skip to content

Allow user to set sirv options #59

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

Open
brillout opened this issue Feb 13, 2025 · 4 comments
Open

Allow user to set sirv options #59

brillout opened this issue Feb 13, 2025 · 4 comments
Assignees

Comments

@brillout
Copy link
Member

Related: #58

@magne4000 I wonder if we could systematically allow the user to add options to internal universal middlewares. Maybe this could be a new Vike setting 🤔. Thinking out loud: maybe we can have a vike-sirv with +sirv, or we keep sirv built-in and let vike-node define the +sirv setting. Not sure which approach is better, I guess there are trade-offs.

@magne4000
Copy link
Member

It would be great indeed to give users a quick access to any middleware configurations.
If middlewares are named, retrieving them would not be an issue.
I'll see what kind of implementation makes sense when I'll dive back into vike-node.

@brillout
Copy link
Member Author

👍 I guess it boils down to whether we want to have sirv built-in or not.

Actually, since sirv is only like 100 LoC I guess it's pretty clear that it should be built-in.

How about this then:

// +config.js

export default {
  server: {
    standalone: true,
    sirv: {
      // ...
    }
  }
}

Or maybe that:

// +config.js

export default {
  sirv: {
    // ...
  }
}

👍 No need to think of "where is this setting again" (I often have that with Vite's nested settings)
👎 Maybe users will first look for "server settings" while thinking "where are the server settings related to static files"

I usually prefer flat settings (maybe it's subjective?), but maybe for this one going nested would make more sense.

@magne4000
Copy link
Member

🤔 Both points are fair. I would say that not everyone knows sirv, so having it inside server helps discovering it. So I think I'll tend a bit more for the non-flat version right now.

@brillout
Copy link
Member Author

👍 Makes sense & agreed.

@magne4000 magne4000 self-assigned this Mar 18, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants