Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix app routes are not correctly matched when src directory is used #43234

Merged
merged 6 commits into from Nov 22, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Expand Up @@ -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({
Expand Down
12 changes: 12 additions & 0 deletions test/e2e/app-dir/app-alias.test.ts
Expand Up @@ -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) {
Expand Down Expand Up @@ -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()
})
}
})