Skip to content

Commit c3b5750

Browse files
committed
detect internal as client, revert changes
1 parent 3300831 commit c3b5750

File tree

11 files changed

+40
-19
lines changed

11 files changed

+40
-19
lines changed

packages/next/build/webpack-config.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1483,7 +1483,7 @@ export default async function getBaseWebpackConfig(
14831483
/next[\\/]dist[\\/]client[\\/]/,
14841484
// To let next/* api entry files passing through flight loader instead
14851485
// of the internal implementation files
1486-
/next[\\/](link|image|future[\\/]image)/,
1486+
// /next[\\/](link|image|future[\\/]image)/,
14871487
],
14881488
issuerLayer: WEBPACK_LAYERS.server,
14891489
use: {

packages/next/build/webpack/loaders/utils.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,14 @@ const imageRegex = new RegExp(`\\.(${imageExtensions.join('|')})$`)
77
const NEXT_API_CLIENT_RSC_REGEX = new RegExp(
88
`next[\\\\/]dist[\\\\/]client[\\\\/](${nextClientComponents.join('|')})\\.js$`
99
)
10-
const NEXT_BUILT_IN_CLIENT_RSC_REGEX = new RegExp(
11-
`next[\\\\/](${nextClientComponents.join('|')})\\.js$`
12-
)
10+
// const NEXT_BUILT_IN_CLIENT_RSC_REGEX = new RegExp(
11+
// `next[\\\\/](${nextClientComponents.join('|')})\\.js$`
12+
// )
1313

1414
// Cover resource paths like `next/*` and `next/dist/client/*`
1515
export function isNextBuiltInClientComponent(resource: string) {
1616
return (
17-
NEXT_BUILT_IN_CLIENT_RSC_REGEX.test(resource) ||
17+
// NEXT_BUILT_IN_CLIENT_RSC_REGEX.test(resource) ||
1818
NEXT_API_CLIENT_RSC_REGEX.test(resource)
1919
)
2020
}

packages/next/build/webpack/plugins/flight-client-entry-plugin.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -247,7 +247,9 @@ export class FlightClientEntryPlugin {
247247

248248
// Check if request is for css file.
249249
if ((!inClientComponentBoundary && isClientComponent) || isCSS) {
250-
clientComponentImports.push(modRequest)
250+
clientComponentImports.push(
251+
isCSS ? modRequest : require.resolve(modRequest)
252+
)
251253
return
252254
}
253255

packages/next/compiled/@edge-runtime/primitives/console.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -567,8 +567,8 @@ var time = console.time.bind(console);
567567
var timeEnd = console.timeEnd.bind(console);
568568
var timeLog = console.timeLog.bind(console);
569569
var trace = console.trace.bind(console);
570-
var error = bareError; // /* @__PURE__ */ __name((...args) => bareError(format(...args)), "error");
571-
var log = bareLog; // /* @__PURE__ */ __name((...args) => bareLog(format(...args)), "log");
570+
var error = /* @__PURE__ */ __name((...args) => bareError(format(...args)), "error");
571+
var log = /* @__PURE__ */ __name((...args) => bareLog(format(...args)), "log");
572572
var konsole = {
573573
assert: (assertion, ...args) => assert(assertion, format(...args)),
574574
count: console.count.bind(console),

test/e2e/app-dir/app/app/dashboard/page.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,6 @@ export default function DashboardPage(props) {
1212
)
1313
}
1414

15-
// export const config = {
16-
// runtime: 'experimental-edge',
17-
// }
15+
export const config = {
16+
runtime: 'experimental-edge',
17+
}
Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,19 @@
11
import { useRouter, withRouter } from 'next/router'
2-
import IsNull from './IsNull'
2+
import IsNull from './is-null'
3+
import ServerRouter from './server-router'
4+
import ClientRouter from './client-router'
35

4-
function ServerRouter({ router: withRouter }) {
6+
function SharedRouter({ router: withRouter }) {
57
const router = useRouter()
68

79
return (
810
<>
911
<IsNull value={withRouter} />
1012
<IsNull value={router} />
13+
<ServerRouter />
14+
<ClientRouter />
1115
</>
1216
)
1317
}
1418

15-
export default withRouter(ServerRouter)
19+
export default withRouter(SharedRouter)

test/e2e/app-dir/app/app/old-router/Router.client.js renamed to test/e2e/app-dir/app/app/old-router/client-router.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
'client'
22

33
import { useRouter, withRouter } from 'next/router'
4-
import IsNull from './IsNull'
4+
import IsNull from './is-null'
55

66
function ClientRouter({ router: withRouter }) {
77
const router = useRouter()
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
import { useRouter, withRouter } from 'next/router'
2+
import IsNull from './is-null'
3+
4+
function ServerRouter({ router: withRouter }) {
5+
const router = useRouter()
6+
7+
return (
8+
<>
9+
<IsNull value={withRouter} />
10+
<IsNull value={router} />
11+
</>
12+
)
13+
}
14+
15+
export default withRouter(ServerRouter)

test/e2e/app-dir/app/app/slow-page-with-loading/page.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,6 @@ export default function SlowPage(props) {
1111
return <h1 id="slow-page-message">{props.message}</h1>
1212
}
1313

14-
// export const config = {
15-
// runtime: 'experimental-edge',
16-
// }
14+
export const config = {
15+
runtime: 'experimental-edge',
16+
}

test/e2e/app-dir/index.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -772,7 +772,7 @@ describe('app dir', () => {
772772
expect(notNull.length).toBe(0)
773773

774774
const wasNull = await browser.elementsByCss('.was-null')
775-
expect(wasNull.length).toBe(2)
775+
expect(wasNull.length).toBe(6)
776776
} finally {
777777
await browser.close()
778778
}

0 commit comments

Comments
 (0)