diff --git a/packages/next/build/webpack/plugins/flight-client-entry-plugin.ts b/packages/next/build/webpack/plugins/flight-client-entry-plugin.ts index 2df42a8d9053..77545f5c2b85 100644 --- a/packages/next/build/webpack/plugins/flight-client-entry-plugin.ts +++ b/packages/next/build/webpack/plugins/flight-client-entry-plugin.ts @@ -203,7 +203,9 @@ export class FlightClientEntryPlugin { : entryRequest // Replace file suffix as `.js` will be added. - const bundlePath = relativeRequest.replace(/\.(js|ts)x?$/, '') + const bundlePath = relativeRequest + .replace(/\.(js|ts)x?$/, '') + .replace(/^src[\\/]/, '') promises.push( this.injectClientEntryAndSSRModules({ diff --git a/test/e2e/app-dir/app-alias.test.ts b/test/e2e/app-dir/app-alias.test.ts index 3b8c434d0507..e857c483236b 100644 --- a/test/e2e/app-dir/app-alias.test.ts +++ b/test/e2e/app-dir/app-alias.test.ts @@ -3,6 +3,7 @@ import { NextInstance } from 'test/lib/next-modes/base' import { renderViaHTTP } from 'next-test-utils' import webdriver from 'next-webdriver' import path from 'path' +import { readJSON } from 'fs-extra' describe('app-dir alias handling', () => { if ((global as any).isNextDeploy) { @@ -41,4 +42,15 @@ describe('app-dir alias handling', () => { .getComputedCss('font-size') expect(fontSize).toBe('50px') }) + + if (!(global as any).isNextDev) { + it('should generate app-build-manifest correctly', async () => { + // Remove other page CSS files: + const manifest = await readJSON( + path.join(next.testDir, '.next', 'app-build-manifest.json') + ) + + expect(manifest.pages).not.toBeEmptyObject() + }) + } })