Enrypase
Enrypase
SSolidJS
Created by Enrypase on 7/26/2024 in #support
defineConfig import.meta.dev
Hi Everybody! I need to archive a (theoretically) easy thing. In my defineConfig inside of app.config.ts, I need to resolve a variable based on if I'm running the server with bun run dev or with bun start. The problem is that, I can't find the environment variable that tells if I'm running as DEV or as PROD. In fact import.meta.env doesn't seem to be exporting a DEV or PROD variable. Is there any way for archiving this? Sharing the code down here
import { defineConfig } from "@solidjs/start/config";
import { resolve } from "path";
import { env } from "process";

export default defineConfig({
vite: {
ssr: {
external: ["@prisma/client"],
},
resolve: {
alias: {
".prisma/client/index-browser":
"./node_modules/.prisma/client/index-browser.js",
$fonts: resolve(
/* import.meta.dev ? */ "/public/fonts" /* : "/fonts" */
),
},
},
server: {
port: parseInt(env.PORT || "3000"),
},
},
server: { preset: env.PRESET || "node-server" },
middleware: "./src/middleware.ts",
});
import { defineConfig } from "@solidjs/start/config";
import { resolve } from "path";
import { env } from "process";

export default defineConfig({
vite: {
ssr: {
external: ["@prisma/client"],
},
resolve: {
alias: {
".prisma/client/index-browser":
"./node_modules/.prisma/client/index-browser.js",
$fonts: resolve(
/* import.meta.dev ? */ "/public/fonts" /* : "/fonts" */
),
},
},
server: {
port: parseInt(env.PORT || "3000"),
},
},
server: { preset: env.PRESET || "node-server" },
middleware: "./src/middleware.ts",
});
31 replies
SSolidJS
Created by Enrypase on 7/17/2024 in #support
Firefox - PROD - CORS Missing Allow Origin
Hi everybody, I have a webapp that uses solid start. Everything works fine with Brave browser, but testing it with Firefox every fetch request fails because of "CORS Missing Allow Origin". (Only on production environment, in development it works fine with every browser) I searched a bit here on discord and on google. But I couldn't find anything. Any suggestion?
1 replies
SSolidJS
Created by Enrypase on 7/15/2024 in #support
"default" is not exported by "src/entry-client.tsx"
Hi everybody, I've noticed the following warning during build time in my project. I tried to create a new project from scratch with > solid start > typescript > tailwindcss, and I was that this warning still persists. I've tried to google it but nothing was found. 📦 Compiling client router... vinxi building router client in client mode vite v5.3.3 building for production... virtual:$vinxi/handler/client (1:101): "default" is not exported by "src/entry-client.tsx", imported by "virtual:$vinxi/handler/client"
9 replies
SSolidJS
Created by Enrypase on 6/4/2024 in #support
Cannot read properties of undefined @ router normalizePath
Hi! My issue is the one described up here in the title. The function that throws it is @solidjs > router > dist > utils.js > normalizePath. I temporarely patched it going from this:
export function normalizePath(path, omitSlash = false) {
const s = path.replace(trimPathRegex, "$1");
return s ? (omitSlash || /^[?#]/.test(s) ? s : "/" + s) : "";
}
export function normalizePath(path, omitSlash = false) {
const s = path.replace(trimPathRegex, "$1");
return s ? (omitSlash || /^[?#]/.test(s) ? s : "/" + s) : "";
}
To this:
export function normalizePath(path, omitSlash = false) {
const s = path?.replace(trimPathRegex, "$1");
return s ? (omitSlash || /^[?#]/.test(s) ? s : "/" + s) : "";
}
export function normalizePath(path, omitSlash = false) {
const s = path?.replace(trimPathRegex, "$1");
return s ? (omitSlash || /^[?#]/.test(s) ? s : "/" + s) : "";
}
(Simply adding a '?' before .replace) The structure of my webapp (where this issue happens) is the following: => Layout: (logged).tsx
export default function LoggedLayout(props: ParentProps) {
return (
<div class="flex">
<Navbar />
<Suspense>
<div class="mt-28 w-full grow p-4 md:ml-[var(--nav-w)] md:mt-auto">
{props.children}
</div>
</Suspense>
</div>
);
}
export default function LoggedLayout(props: ParentProps) {
return (
<div class="flex">
<Navbar />
<Suspense>
<div class="mt-28 w-full grow p-4 md:ml-[var(--nav-w)] md:mt-auto">
{props.children}
</div>
</Suspense>
</div>
);
}
=> And the page where the issue happens: index.tsx:
const queryFn = axios.get("http//...")

export const route = {
load() {
// prefetch w cache
},
} satisfies RouteDefinition;
export default function Home() {
const opportunities = // query data
return (
<section class="flex flex-col gap-5">
<For each={opportunities.data}>
{(category) => {
return (
<div>
<p>{category.tagTitle}</p>
<div class="grid grid-cols-opportunities gap-5">
<For each={category.opportunities}>
{(opp, i) => (
<GeneralOpportunity
{...opp}
tags={[category.tagTitle]}
idx={i()}
/>
)}
</For>
</div>
</div>
);
}}
</For>
</section>
);
}
const queryFn = axios.get("http//...")

export const route = {
load() {
// prefetch w cache
},
} satisfies RouteDefinition;
export default function Home() {
const opportunities = // query data
return (
<section class="flex flex-col gap-5">
<For each={opportunities.data}>
{(category) => {
return (
<div>
<p>{category.tagTitle}</p>
<div class="grid grid-cols-opportunities gap-5">
<For each={category.opportunities}>
{(opp, i) => (
<GeneralOpportunity
{...opp}
tags={[category.tagTitle]}
idx={i()}
/>
)}
</For>
</div>
</div>
);
}}
</For>
</section>
);
}
Am I doing something wrong? Thanks : )
8 replies