@@ -354,6 +354,62 @@ describe('tsconfig.json verifier', () => {
354
354
` )
355
355
} )
356
356
357
+ it ( 'allows you to set bundler moduleResolution mode' , async ( ) => {
358
+ expect ( await exists ( tsConfig ) ) . toBe ( false )
359
+
360
+ await writeFile (
361
+ tsConfig ,
362
+ `{ "compilerOptions": { "esModuleInterop": false, "moduleResolution": "bundler" } }`
363
+ )
364
+ await new Promise ( ( resolve ) => setTimeout ( resolve , 500 ) )
365
+ const { code, stderr, stdout } = await nextBuild ( appDir , undefined , {
366
+ stderr : true ,
367
+ stdout : true ,
368
+ } )
369
+ expect ( stderr + stdout ) . not . toContain ( 'moduleResolution' )
370
+ expect ( code ) . toBe ( 0 )
371
+
372
+ expect ( await readFile ( tsConfig , 'utf8' ) ) . toMatchInlineSnapshot ( `
373
+ "{
374
+ \\"compilerOptions\\": {
375
+ \\"esModuleInterop\\": true,
376
+ \\"moduleResolution\\": \\"bundler\\",
377
+ \\"lib\\": [
378
+ \\"dom\\",
379
+ \\"dom.iterable\\",
380
+ \\"esnext\\"
381
+ ],
382
+ \\"allowJs\\": true,
383
+ \\"skipLibCheck\\": true,
384
+ \\"strict\\": false,
385
+ \\"forceConsistentCasingInFileNames\\": true,
386
+ \\"noEmit\\": true,
387
+ \\"incremental\\": true,
388
+ \\"module\\": \\"esnext\\",
389
+ \\"resolveJsonModule\\": true,
390
+ \\"isolatedModules\\": true,
391
+ \\"jsx\\": \\"preserve\\",
392
+ \\"plugins\\": [
393
+ {
394
+ \\"name\\": \\"next\\"
395
+ }
396
+ ],
397
+ \\"strictNullChecks\\": true
398
+ },
399
+ \\"include\\": [
400
+ \\"next-env.d.ts\\",
401
+ \\".next/types/**/*.ts\\",
402
+ \\"**/*.ts\\",
403
+ \\"**/*.tsx\\"
404
+ ],
405
+ \\"exclude\\": [
406
+ \\"node_modules\\"
407
+ ]
408
+ }
409
+ "
410
+ ` )
411
+ } )
412
+
357
413
it ( 'allows you to set target mode' , async ( ) => {
358
414
expect ( await exists ( tsConfig ) ) . toBe ( false )
359
415
0 commit comments