Skip to content

Commit

Permalink
add test case; ignore hot-update.js
Browse files Browse the repository at this point in the history
  • Loading branch information
shuding committed Apr 19, 2023
1 parent 1827f36 commit 350d4c1
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -263,6 +263,8 @@ export class ClientReferenceManifestPlugin {
// It's possible that a chunk also emits CSS files, that will
// be handled separatedly.
if (!file.endsWith('.js')) return null
if (file.endsWith('.hot-update.js')) return null

return requiredChunk.id + ':' + file
})
})
Expand Down
5 changes: 5 additions & 0 deletions test/e2e/app-dir/dynamic/app/chunk-loading/comp.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
'use client'

export default function () {
return <h1>hello</h1>
}
11 changes: 11 additions & 0 deletions test/e2e/app-dir/dynamic/app/chunk-loading/page.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
// This file is needed for the test, to ensure that the "comp.js" module is
// created as a dynamic import chunk.

'use client'

export default function Page() {
import('./comp').then((m) => {
console.log(m)
})
return null
}
5 changes: 5 additions & 0 deletions test/e2e/app-dir/dynamic/app/chunk-loading/server/page.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import Comp from '../comp'

export default function Page() {
return <Comp />
}
5 changes: 5 additions & 0 deletions test/e2e/app-dir/dynamic/dynamic.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,5 +52,10 @@ createNextDescribe(
await browser.elementByCss('#css-text-dynamic-no-ssr-client').text()
).toBe('next-dynamic dynamic no ssr on client:suffix')
})

it('should generate correct client manifest for dynamic chunks', async () => {
const $ = await next.render$('/chunk-loading/server')
expect($('h1').text()).toBe('hello')
})
}
)

0 comments on commit 350d4c1

Please sign in to comment.