Edivado
Edivado
SSolidJS
Created by thetarnav on 1/1/2024 in #support
dev or build when using new solid start
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"] : [],
},
}
}
}
]
})
6 replies
SSolidJS
Created by Samual 🦢 on 9/7/2023 in #support
set response header from within `createServerData$()` callback
leaving this here: https://github.com/solidjs/solid-start/pull/485#issuecomment-1676906831 also @giyomoon created a patch that let's you use responseHeaders in both cases https://github.com/solidjs/solid-start/pull/485#issuecomment-1677699897
8 replies
SSolidJS
Created by Silverdagger on 8/31/2023 in #support
Missing Http method returns 200 status code on api route
Ok strange... opened a PR. Should cover it. It's a bit more complicated than I thought. https://github.com/solidjs/solid-start/pull/1041
20 replies
SSolidJS
Created by Martnart on 8/28/2023 in #support
Building with SSR false starts (and doesn't close) listeners
Aww I don't feel like I have done much but totally appreciate the kind words. 😄
Regarding the current spa build process. The longer I think about it and look at the code it's starting to seem insane to call the server (through vite dev or directly) to generate the index.html. At the end its just the entry point for the client build (single script tag pointing to entry-client). I feel like I am missing something but it looks to me as if generating the index.html from a hardcoded string would be the same. It doesn't seem like its creating anything dynamically or using something provided by the user. nvm I kind of understand now why it is like that. I am also not too sure about creating the websocket server in entry-server but thats probably me not knowing the use case. My first thought would be to run it separately or trying to run it as a middleware if possible.
18 replies
SSolidJS
Created by Martnart on 8/28/2023 in #support
Building with SSR false starts (and doesn't close) listeners
Anyway... in this specific case I don't see any other solution beside what you did and try to terminate all related processes. Only thing I see avoiding this is providing an index.html in the project root so the build process does not run entry-server.
18 replies
SSolidJS
Created by Martnart on 8/28/2023 in #support
Building with SSR false starts (and doesn't close) listeners
Regarding this: Edit: as a side note I was also able to "fix" this by changing the stdio option. But in this specific case they bring their own bugs Was this with detached set to true? I didn't notice any difference by just changing stdio.
18 replies
SSolidJS
Created by Martnart on 8/28/2023 in #support
Building with SSR false starts (and doesn't close) listeners
My suggestion has a similar problem which I expected after seeing the server initialization. Building works but the websocket server will block until its explicitly closed (ctrl+c). 🤣
18 replies
SSolidJS
Created by Martnart on 8/28/2023 in #support
Building with SSR false starts (and doesn't close) listeners
Thats good, better then waiting and I want to reproduce the error first. Thanks for the detailed steps I will try it out.
18 replies
SSolidJS
Created by Martnart on 8/28/2023 in #support
Building with SSR false starts (and doesn't close) listeners
Sure but If you could help me understand / reproduce the issue that would be cool. I don't quite know how to reproduce EADDRINUSE on my Windows machine. Any hint/steps woulb be nice. Like where do I need to add the long running listener or was this referring to vite?
18 replies
SSolidJS
Created by Martnart on 8/28/2023 in #support
Building with SSR false starts (and doesn't close) listeners
Left a suggestion on the PR.
18 replies
SSolidJS
Created by Grahf on 7/17/2023 in #support
Replace part of string with a component
Its fine no need to. Out of my own curiosity I took a closer look at the libs implementation. I don't understand why it would use split instead of matchAll after reading about splits behaviour with capturing groups. I made a small gist with matchAll. https://gist.github.com/edivados/0b24fd7e876d1940fd273361a31ffe1c (you have to use g flag with matchAll)
28 replies
SSolidJS
Created by MattS on 7/17/2023 in #support
Can the server$ call get access to the Request object?
Should one in most cases stay away from server$? createServerData$ is according to the docs a wrapper around createRouteData + server$
10 replies
SSolidJS
Created by Grahf on 7/17/2023 in #support
Replace part of string with a component
I guess you would have to test your regex against split and play by its rules because that is what it's using internally.
28 replies
SSolidJS
Created by Grahf on 7/17/2023 in #support
Replace part of string with a component
Have a good rest
28 replies
SSolidJS
Created by Grahf on 7/17/2023 in #support
Replace part of string with a component
Does not handle all edge cases and match.index could be undefined just for testing
28 replies
SSolidJS
Created by Grahf on 7/17/2023 in #support
Replace part of string with a component
In case you want to try here:
function regReplaceWithComponent(
text: string,
exp: RegExp,
fn: (match: string, index: number) => JSXElement
) {
const matches = [...text.matchAll(exp)];
if (!matches.length) return text;
return matches.reduce((items, match, index, matches) => {
const offset = index
? matches[index - 1].index! + matches[index - 1][0].length
: 0;

items.push(text.slice(offset, match.index));
items.push(fn(match[0], index));

if (
index === matches.length - 1 &&
match.index! + match[0].length < text.length
) {
items.push(text.slice(match.index! + match[0].length));
}

return items;
}, [] as JSXElement[]);
}
function regReplaceWithComponent(
text: string,
exp: RegExp,
fn: (match: string, index: number) => JSXElement
) {
const matches = [...text.matchAll(exp)];
if (!matches.length) return text;
return matches.reduce((items, match, index, matches) => {
const offset = index
? matches[index - 1].index! + matches[index - 1][0].length
: 0;

items.push(text.slice(offset, match.index));
items.push(fn(match[0], index));

if (
index === matches.length - 1 &&
match.index! + match[0].length < text.length
) {
items.push(text.slice(match.index! + match[0].length));
}

return items;
}, [] as JSXElement[]);
}
28 replies
SSolidJS
Created by Grahf on 7/17/2023 in #support
Replace part of string with a component
i tried it with my own incomplete implementation of replace and that one seems to work
28 replies
SSolidJS
Created by Grahf on 7/17/2023 in #support
Replace part of string with a component
to me that looks like an issue with the lib
28 replies
SSolidJS
Created by Grahf on 7/17/2023 in #support
Replace part of string with a component
Do you have some sample text I could try your regex on?
28 replies
SSolidJS
Created by MattS on 7/17/2023 in #support
Can the server$ call get access to the Request object?
You should be able to access the request with server$.request
10 replies