Skip to content

Instantly share code, notes, and snippets.

@ivanbarlog
Last active March 7, 2025 13:24
Show Gist options
  • Select an option

  • Save ivanbarlog/a988beeb198b73a51b5c81ca2fbe5203 to your computer and use it in GitHub Desktop.

Select an option

Save ivanbarlog/a988beeb198b73a51b5c81ca2fbe5203 to your computer and use it in GitHub Desktop.
RR7 + vite + editorjs => umd?
"@editorjs/editorjs": "^2.30.7",
"@react-router/node": "^7.2.0",
"@react-router/serve": "^7.2.0",
"editorjs-html": "^3.4.3",
"react": "^19.0.0",
"react-dom": "^19.0.0",
"react-router": "^7.2.0",
"react-router-aws": "^2.0.0-beta.2",
"typescript": "^5.7.3",
"vite": "^6.1.1",
"vite-tsconfig-paths": "^5.1.4"
"@react-router/dev": "^7.2.0",
"@types/node": "^22.13.5",
"@types/react": "^19.0.10",
"@types/react-dom": "^19.0.4",
"react-router-devtools": "^1.1.5",
{
"include": [
"**/*",
"**/.server/**/*",
"**/.client/**/*",
".react-router/types/**/*"
],
"exclude": ["cdk.out", "node_modules", "build"],
"compilerOptions": {
"lib": ["DOM", "DOM.Iterable", "ES2022"],
"types": ["node", "vite/client"],
"target": "ES2022",
"module": "ES2022",
"moduleResolution": "bundler",
"jsx": "react-jsx",
"rootDirs": [".", "./.react-router/types"],
"baseUrl": ".",
"paths": {
"~/*": ["./app/*"]
},
"esModuleInterop": true,
"verbatimModuleSyntax": true,
"noEmit": true,
"resolveJsonModule": true,
"skipLibCheck": true,
"strict": true
}
}
import { reactRouter } from "@react-router/dev/vite";
import { defineConfig } from "vite";
import tsconfigPaths from "vite-tsconfig-paths";
export default defineConfig(({ command }) => {
return {
plugins: [
reactRouter(),
tsconfigPaths(),
{
name: "react-router-apigatewayv2-adapter",
apply(_config, env): boolean {
return env.command === "build" && env?.isSsrBuild === true;
},
config: async () => {
return {
build: {
ssr: true,
rollupOptions: {
input: { index: "handler.ts" },
output: {
entryFileNames: "[name].mjs",
chunkFileNames: "assets/[name]-[hash].mjs",
},
external: ["better-sqlite3"],
},
},
};
},
},
],
ssr: command === "build" ? { noExternal: true, target: "node" } : {},
};
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment