Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enhance RouterProvider for SSR #11396

Merged
merged 6 commits into from
Apr 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion packages/react-router-dom-v5-compat/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,10 @@
"types": "./dist/index.d.ts",
"dependencies": {
"@remix-run/router": "workspace:*",
"@remix-run/server-runtime": "workspace:*",
"history": "^5.3.0",
"react-router": "workspace:*"
"react-router": "workspace:*",
"turbo-stream": "^2.0.0"
},
"peerDependencies": {
"react": ">=16.8",
Expand Down
22 changes: 14 additions & 8 deletions packages/react-router-dom-v5-compat/rollup.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,7 @@ const { name, version } = require("./package.json");

module.exports = function rollup() {
const { ROOT_DIR, SOURCE_DIR, OUTPUT_DIR } = getBuildDirectories(name);
const ROUTER_DOM_SOURCE = path.join(
ROOT_DIR,
"packages",
"react-router-dom",
"(index|dom).ts*"
);
const ROUTER_DOM_COPY_DEST = path.join(SOURCE_DIR, "react-router-dom");
const RR_DOM_DIR = path.join(ROOT_DIR, "packages", "react-router-dom");

// JS modules for bundlers
let modules = [
Expand All @@ -45,7 +39,19 @@ module.exports = function rollup() {
],
plugins: [
copy({
targets: [{ src: ROUTER_DOM_SOURCE, dest: ROUTER_DOM_COPY_DEST }],
targets: [
{
src: path.join(RR_DOM_DIR, "(index|dom).ts*"),
dest: path.join(SOURCE_DIR, "react-router-dom"),
},
{
src: [
path.join(RR_DOM_DIR, "ssr", "*.ts*"),
"!" + path.join(RR_DOM_DIR, "ssr", "server.tsx"),
],
dest: path.join(SOURCE_DIR, "react-router-dom", "ssr"),
},
],
// buildStart is not soon enough to run before the typescript plugin :/
hook: "options",
verbose: true,
Expand Down
Loading
Loading