add cloudflare workers support for all frontends (#366)

This commit is contained in:
Aman Varshney
2025-07-05 15:51:26 +05:30
committed by GitHub
parent 6499f8cf04
commit d2674270a4
53 changed files with 1213 additions and 159 deletions

View File

@@ -5,3 +5,6 @@ dist-ssr
*.local
.env
.env.*
.wrangler
.dev.vars*

View File

@@ -4,7 +4,7 @@
"type": "module",
"scripts": {
"dev": "vite --port 3001",
"build": "vite build && tsc",
"build": "vite build",
"serve": "vite preview",
"test": "vitest run"
},
@@ -21,7 +21,7 @@
},
"devDependencies": {
"typescript": "^5.7.2",
"vite": "^6.0.11",
"vite": "^7.0.2",
"vite-plugin-solid": "^2.11.2"
}
}

View File

@@ -4,7 +4,7 @@ import { routeTree } from "./routeTree.gen";
import "./styles.css";
{{#if (eq api "orpc")}}
import { QueryClientProvider } from "@tanstack/solid-query";
import { queryClient } from "./utils/orpc";
import { orpc, queryClient } from "./utils/orpc";
{{/if}}
const router = createRouter({
@@ -12,6 +12,9 @@ const router = createRouter({
defaultPreload: "intent",
scrollRestoration: true,
defaultPreloadStaleTime: 0,
{{#if (eq api "orpc")}}
context: { orpc, queryClient },
{{/if}}
});
declare module "@tanstack/solid-router" {

View File

@@ -1,39 +0,0 @@
import { defineConfig } from "vite";
import { TanStackRouterVite } from "@tanstack/router-plugin/vite";
import solidPlugin from "vite-plugin-solid";
import tailwindcss from "@tailwindcss/vite";
import path from "node:path";
{{#if (includes addons "pwa")}}
import { VitePWA } from "vite-plugin-pwa";
{{/if}}
export default defineConfig({
plugins: [
TanStackRouterVite({ target: "solid", autoCodeSplitting: true }),
solidPlugin(),
tailwindcss(),
{{#if (includes addons "pwa")}}
VitePWA({
registerType: "autoUpdate",
manifest: {
name: "{{projectName}}",
short_name: "{{projectName}}",
description: "{{projectName}} - PWA Application",
theme_color: "#0c0c0c",
},
pwaAssets: {
disabled: false,
config: true,
},
devOptions: {
enabled: true,
},
}),
{{/if}}
],
resolve: {
alias: {
"@": path.resolve(__dirname, "./src"),
},
},
});

View File

@@ -0,0 +1,18 @@
import { defineConfig } from "vite";
import { tanstackRouter } from "@tanstack/router-plugin/vite";
import solidPlugin from "vite-plugin-solid";
import tailwindcss from "@tailwindcss/vite";
import path from "node:path";
export default defineConfig({
plugins: [
tanstackRouter({ target: "solid", autoCodeSplitting: true }),
solidPlugin(),
tailwindcss(),
],
resolve: {
alias: {
"@": path.resolve(__dirname, "./src"),
},
},
});