File tree Expand file tree Collapse file tree 3 files changed +14
-14
lines changed
test/e2e/app-dir/app-external Expand file tree Collapse file tree 3 files changed +14
-14
lines changed Original file line number Diff line number Diff line change @@ -37,7 +37,7 @@ createNextDescribe(
37
37
buildCommand : 'yarn build' ,
38
38
skipDeployment : true ,
39
39
} ,
40
- ( { next, isNextStart } ) => {
40
+ ( { next } ) => {
41
41
it ( 'should be able to opt-out 3rd party packages being bundled in server components' , async ( ) => {
42
42
await next . fetch ( '/react-server/optout' ) . then ( async ( response ) => {
43
43
const result = await resolveStreamResponse ( response )
@@ -246,15 +246,13 @@ createNextDescribe(
246
246
} )
247
247
248
248
it ( 'should have proper tree-shaking for known modules in CJS' , async ( ) => {
249
- const html = await next . render ( '/test-middleware ' )
250
- expect ( html ) . toContain ( 'it works ' )
249
+ const html = await next . render ( '/cjs/server ' )
250
+ expect ( html ) . toContain ( 'resolve response ' )
251
251
252
- if ( isNextStart ) {
253
- const middlewareBundle = await next . readFile (
254
- '.next/server/middleware.js'
255
- )
256
- expect ( middlewareBundle ) . not . toContain ( 'image-response' )
257
- }
252
+ const outputFile = await next . readFile (
253
+ '.next/server/app/cjs/server/page.js'
254
+ )
255
+ expect ( outputFile ) . not . toContain ( 'image-response' )
258
256
} )
259
257
260
258
it ( 'should use the same async storages if imported directly' , async ( ) => {
Original file line number Diff line number Diff line change
1
+ import { createResponse } from 'next-server-cjs-lib'
2
+
3
+ export default async function Page ( ) {
4
+ const response = createResponse ( 'resolve response' )
5
+ const text = await response . text ( )
6
+ return < p > { text } </ p >
7
+ }
Original file line number Diff line number Diff line change 1
- import { createResponse } from 'next-server-cjs-lib'
2
1
import { respond } from 'compat-next-server-module'
3
2
4
3
export async function middleware ( request ) {
5
- if ( request . nextUrl . pathname === '/test-middleware' ) {
6
- return createResponse ( 'it works' )
7
- }
8
-
9
4
return await respond ( )
10
5
}
You can’t perform that action at this time.
0 commit comments