File tree Expand file tree Collapse file tree 4 files changed +25
-7
lines changed
server/future/normalizers/built/app
test/e2e/app-dir/app-edge Expand file tree Collapse file tree 4 files changed +25
-7
lines changed Original file line number Diff line number Diff line change @@ -16,6 +16,7 @@ import { getProxiedPluginState } from '../../build-context'
16
16
17
17
import { nonNullable } from '../../../lib/non-nullable'
18
18
import { WEBPACK_LAYERS } from '../../../lib/constants'
19
+ import { normalizePagePath } from '../../../shared/lib/page-path/normalize-page-path'
19
20
20
21
interface Options {
21
22
dev : boolean
@@ -394,12 +395,18 @@ export class ClientReferenceManifestPlugin {
394
395
const json = JSON . stringify ( mergedManifest )
395
396
396
397
const pagePath = groupName . replace ( / % 5 F / g, '_' )
397
- assets [ 'server/' + pagePath + '_' + CLIENT_REFERENCE_MANIFEST + '.js' ] =
398
- new sources . RawSource (
399
- `globalThis.__RSC_MANIFEST=(globalThis.__RSC_MANIFEST||{});globalThis.__RSC_MANIFEST[${ JSON . stringify (
400
- pagePath . slice ( 'app' . length )
401
- ) } ]=${ JSON . stringify ( json ) } `
402
- ) as unknown as webpack . sources . RawSource
398
+ const pageBundlePath = normalizePagePath ( pagePath . slice ( 'app' . length ) )
399
+ assets [
400
+ 'server/app' +
401
+ pageBundlePath +
402
+ '_' +
403
+ CLIENT_REFERENCE_MANIFEST +
404
+ '.js'
405
+ ] = new sources . RawSource (
406
+ `globalThis.__RSC_MANIFEST=(globalThis.__RSC_MANIFEST||{});globalThis.__RSC_MANIFEST[${ JSON . stringify (
407
+ pagePath . slice ( 'app' . length )
408
+ ) } ]=${ JSON . stringify ( json ) } `
409
+ ) as unknown as webpack . sources . RawSource
403
410
404
411
if ( pagePath === 'app/not-found' ) {
405
412
// Create a separate special manifest for the root not-found page.
Original file line number Diff line number Diff line change 1
1
import { Normalizers } from '../../normalizers'
2
2
import { Normalizer } from '../../normalizer'
3
3
import { PrefixingNormalizer } from '../../prefixing-normalizer'
4
+ import { normalizePagePath } from '../../../../../shared/lib/page-path/normalize-page-path'
4
5
5
6
export class AppBundlePathNormalizer extends PrefixingNormalizer {
6
7
constructor ( ) {
7
8
super ( 'app' )
8
9
}
9
10
10
11
public normalize ( page : string ) : string {
11
- return super . normalize ( page )
12
+ return super . normalize ( normalizePagePath ( page ) )
12
13
}
13
14
}
14
15
Original file line number Diff line number Diff line change @@ -21,6 +21,11 @@ createNextDescribe(
21
21
expect ( await res . text ( ) ) . toInclude ( 'Hello' )
22
22
} )
23
23
24
+ it ( 'should handle /index routes correctly' , async ( ) => {
25
+ const appHtml = await next . render ( '/index' )
26
+ expect ( appHtml ) . toContain ( 'the /index route' )
27
+ } )
28
+
24
29
if ( ( globalThis as any ) . isNextDev ) {
25
30
it ( 'should resolve module without error in edge runtime' , async ( ) => {
26
31
const logs = [ ]
Original file line number Diff line number Diff line change
1
+ export default function Page ( ) {
2
+ return < p > the /index route</ p >
3
+ }
4
+
5
+ export const runtime = 'edge'
You can’t perform that action at this time.
0 commit comments