Skip to content

Commit

Permalink
Make the example work in-repo.
Browse files Browse the repository at this point in the history
  • Loading branch information
cpojer committed Jan 10, 2025
1 parent c89a533 commit acd251f
Show file tree
Hide file tree
Showing 4 changed files with 3,535 additions and 230 deletions.
8 changes: 4 additions & 4 deletions example/react-router-cloudflare-example/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"sideEffects": false,
"type": "module",
"scripts": {
"build": "NODE_ENV=production react-router build",
"build": "NODE_ENV=production pnpm fbtee:manifest && pnpm fbtee:collect && pnpm fbtee:translate && react-router build",
"fbtee:manifest": "fbtee manifest --src app",
"fbtee:collect": "fbtee collect --manifest < .src_manifest.json > .source_strings.json",
"fbtee:translate": "fbtee translate --translations app/i18n/*.json --jenkins > app/translations.json",
Expand All @@ -18,15 +18,15 @@
"dependencies": {
"@react-router/serve": "^7.1.1",
"drizzle-orm": "~0.38.3",
"fbtee": "^0.2.0",
"fbtee": "workspace:^",
"isbot": "^5.1.19",
"react": "^19.0.0",
"react-dom": "^19.0.0",
"react-router": "^7.1.1"
},
"devDependencies": {
"@cloudflare/workers-types": "^4.20241230.0",
"@nkzw/babel-preset-fbtee": "^0.2.0",
"@nkzw/babel-preset-fbtee": "workspace:^",
"@react-router/dev": "^7.1.1",
"@types/node": "^22.10.5",
"@types/react": "^19.0.2",
Expand All @@ -41,4 +41,4 @@
"wrangler": "^3.99.0"
},
"packageManager": "[email protected]"
}
}
48 changes: 24 additions & 24 deletions example/react-router-cloudflare-example/vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import autoprefixer from "autoprefixer";
import tailwindcss from "tailwindcss";
import { defineConfig } from "vite";
import tsconfigPaths from "vite-tsconfig-paths";
import fbteePreset from '@nkzw/babel-preset-fbtee';
import react from '@vitejs/plugin-react';
import fbteePreset from "@nkzw/babel-preset-fbtee";
import react from "@vitejs/plugin-react";
import { getLoadContext } from "./load-context";

export default defineConfig(({ isSsrBuild }) => ({
Expand All @@ -26,25 +26,6 @@ export default defineConfig(({ isSsrBuild }) => ({
plugins: [tailwindcss, autoprefixer],
},
},
ssr: {
target: "webworker",
noExternal: true,
external: ["node:async_hooks"],
resolve: {
conditions: ["workerd", "browser"],
},
optimizeDeps: {
include: [
"react",
"react/jsx-runtime",
"react/jsx-dev-runtime",
"react-dom",
"react-dom/server",
"react-router",
"fbtee"
],
},
},
plugins: [
react({
babel: {
Expand All @@ -54,9 +35,6 @@ export default defineConfig(({ isSsrBuild }) => ({
cloudflareDevProxy({ getLoadContext }),
reactRouter(),
{
// This plugin is required so both `index.js` / `worker.js can be
// generated for the `build` config above
name: "react-router-cloudflare-workers",
config: () => ({
build: {
rollupOptions: isSsrBuild
Expand All @@ -68,7 +46,29 @@ export default defineConfig(({ isSsrBuild }) => ({
: undefined,
},
}),
// This plugin is required so both `index.js` / `worker.js can be
// generated for the `build` config above
name: "react-router-cloudflare-workers",
},
tsconfigPaths(),
],
ssr: {
external: ["node:async_hooks"],
noExternal: true,
optimizeDeps: {
include: [
"react",
"react/jsx-runtime",
"react/jsx-dev-runtime",
"react-dom",
"react-dom/server",
"react-router",
"fbtee",
],
},
resolve: {
conditions: ["workerd", "browser"],
},
target: "webworker",
},
}));
Loading

0 comments on commit acd251f

Please sign in to comment.