diff --git a/packages/next/src/client/app-next-dev.ts b/packages/next/src/client/app-next-dev.ts
index a97caf4bcc231..cac83496b36b2 100644
--- a/packages/next/src/client/app-next-dev.ts
+++ b/packages/next/src/client/app-next-dev.ts
@@ -1,9 +1,9 @@
// TODO-APP: hydration warning
+import './app-webpack'
import { appBootstrap } from './app-bootstrap'
appBootstrap(() => {
- require('./app-webpack')
const { hydrate } = require('./app-index')
hydrate()
})
diff --git a/packages/next/src/client/app-next.ts b/packages/next/src/client/app-next.ts
index 29e1dab5c91f3..1ac94dc017f2a 100644
--- a/packages/next/src/client/app-next.ts
+++ b/packages/next/src/client/app-next.ts
@@ -1,9 +1,9 @@
+// This import must go first because it needs to patch webpack chunk loading
+// before React patches chunk loading.
+import './app-webpack'
import { appBootstrap } from './app-bootstrap'
appBootstrap(() => {
- // This import must go first because it needs to patch webpack chunk loading
- // before React patches chunk loading.
- require('./app-webpack')
const { hydrate } = require('./app-index')
// Include app-router and layout-router in the main chunk
require('next/dist/client/components/app-router')
diff --git a/test/e2e/app-dir/navigation/app/router/dynamic-gsp/[slug]/error.js b/test/e2e/app-dir/navigation/app/router/dynamic-gsp/[slug]/error.js
new file mode 100644
index 0000000000000..488098e6e921c
--- /dev/null
+++ b/test/e2e/app-dir/navigation/app/router/dynamic-gsp/[slug]/error.js
@@ -0,0 +1,8 @@
+// Add error.js to let this file be added to the flight manifest,
+// and get url encoded, and load through react RSC renderer.
+
+'use client'
+
+export default function Error() {
+ return
My Error
+}
diff --git a/test/e2e/app-dir/navigation/app/router/dynamic-gsp/[slug]/page.js b/test/e2e/app-dir/navigation/app/router/dynamic-gsp/[slug]/page.js
new file mode 100644
index 0000000000000..d46142399e584
--- /dev/null
+++ b/test/e2e/app-dir/navigation/app/router/dynamic-gsp/[slug]/page.js
@@ -0,0 +1,7 @@
+export default function Page({ params }) {
+ return