dev or build when using new solid start

since defineConfig doesn't allow passing a callback anymore, how does else can I check whether I'm doing a production build or running a dev server? previously I did this:
import {defineConfig} from "vite"

export default defineConfig((props) => {
const is_dev = props.command === "serve"
return {
optimizeDeps: {
exclude: is_dev ? ["some_dep_i_don't want_cached_in_dev"] : [],
},
}
})
import {defineConfig} from "vite"

export default defineConfig((props) => {
const is_dev = props.command === "serve"
return {
optimizeDeps: {
exclude: is_dev ? ["some_dep_i_don't want_cached_in_dev"] : [],
},
}
})
3 Replies
Alex Lohr
Alex Lohr12mo ago
There might be some environment variables.
Edivado
Edivado12mo ago
This should work. Plugins are added to multiple vinxi routers (client, ssr, server-fns etc.). In case you want to apply it to only one of them you can check config.router.name
import { defineConfig } from "@solidjs/start/config";

export default defineConfig({
plugins: [
{
name: "some-name",
config(config, env) {
const is_dev = env.command === "serve"
return {
optimizeDeps: {
exclude: is_dev ? ["some_dep_i_don't want_cached_in_dev"] : [],
},
}
}
}
]
})
import { defineConfig } from "@solidjs/start/config";

export default defineConfig({
plugins: [
{
name: "some-name",
config(config, env) {
const is_dev = env.command === "serve"
return {
optimizeDeps: {
exclude: is_dev ? ["some_dep_i_don't want_cached_in_dev"] : [],
},
}
}
}
]
})
thetarnav
thetarnavOP12mo ago
I tried but I didn’t see anything useful there I can always do DEV=1 vinxi dev in scripts but I was looking for something more convenient interesting, thank you I’ll try it
Want results from more Discord servers?
Add your server