Vinxi conditional config by mode

Is there a way to set up app.config.ts to be aware of the mode in which Vinxi is being run? When using Vite directly, the following is possible: https://vite.dev/config/#conditional-config It does not appear that SolidStart's defineConfig is similarly capable of taking a function that is aware of the mode in which Vinxi is being run.
vitejs
Configuring Vite
Next Generation Frontend Tooling
7 Replies
TaQuanMinhLong
TaQuanMinhLong•4w ago
I think you can check here
TaQuanMinhLong
TaQuanMinhLong•4w ago
Nitro seems to have each handler according to each mode :Worry_Think:
mdynnl
mdynnl•4w ago
It does not appear that SolidStart's defineConfig is similarly capable of taking a function that is aware of the mode in which Vinxi is being run.
Yeah, currently vinxi only expose the router type through vite({ router }) I think you sort of have to workaround using env vars
SilentRhetoric
SilentRhetoricOP•4w ago
That doesn't actually do what I want to achieve The environment is a different concept from how Vinxi (Vite) has been invoked But maybe I am missing something here
mdynnl
mdynnl•4w ago
it definitely makes sense to implement this feature though but assuming you don't have time and effort for that, the workaround i meant is like this
// package.json
{
"scripts": {
"dev": "VINXI_CMD=dev vinxi dev",
"start": "VINXI_CMD=start vinxi start",
"build": "VINXI_CMD=build vinxi build"
}
}
// package.json
{
"scripts": {
"dev": "VINXI_CMD=dev vinxi dev",
"start": "VINXI_CMD=start vinxi start",
"build": "VINXI_CMD=build vinxi build"
}
}
// app.config.ts
// could even have different configs depending
// app.config.dev.ts, app.config.prod.ts
// or make a wrapper function along the lines of vite's
export default process.env.VINXI_CMD === 'dev' ? defineConfig() : defineConfig()
// app.config.ts
// could even have different configs depending
// app.config.dev.ts, app.config.prod.ts
// or make a wrapper function along the lines of vite's
export default process.env.VINXI_CMD === 'dev' ? defineConfig() : defineConfig()
SilentRhetoric
SilentRhetoricOP•4w ago
Unfortunately, I am holding another technology stack together with spit and glue right now and will not find time to work on this Vinxi enhancement in the near future 😅
Want results from more Discord servers?
Add your server