Unverified Commit 73fbd698 authored by JJ Kasper's avatar JJ Kasper Committed by GitHub

Fix trace case with tsconfig/jsconfig baseUrl (#30286)

parent 0910e8b8
...@@ -476,10 +476,12 @@ export class TraceEntryPointsPlugin implements webpack5.WebpackPluginInstance { ...@@ -476,10 +476,12 @@ export class TraceEntryPointsPlugin implements webpack5.WebpackPluginInstance {
const CJS_RESOLVE_OPTIONS = { const CJS_RESOLVE_OPTIONS = {
...NODE_RESOLVE_OPTIONS, ...NODE_RESOLVE_OPTIONS,
modules: undefined,
extensions: undefined, extensions: undefined,
} }
const ESM_RESOLVE_OPTIONS = { const ESM_RESOLVE_OPTIONS = {
...NODE_ESM_RESOLVE_OPTIONS, ...NODE_ESM_RESOLVE_OPTIONS,
modules: undefined,
extensions: undefined, extensions: undefined,
} }
......
...@@ -8,6 +8,7 @@ import { ...@@ -8,6 +8,7 @@ import {
findPort, findPort,
launchApp, launchApp,
killApp, killApp,
nextBuild,
check, check,
} from 'next-test-utils' } from 'next-test-utils'
...@@ -61,4 +62,21 @@ describe('TypeScript Features', () => { ...@@ -61,4 +62,21 @@ describe('TypeScript Features', () => {
expect(found).toBe(true) expect(found).toBe(true)
}) })
}) })
describe('should build', () => {
beforeAll(async () => {
await nextBuild(appDir)
})
it('should trace correctly', async () => {
const helloTrace = await fs.readJSON(
join(appDir, '.next/server/pages/hello.js.nft.json')
)
expect(
helloTrace.files.some((file) => file.includes('components/world.js'))
).toBe(true)
expect(
helloTrace.files.some((file) => file.includes('react/index.js'))
).toBe(true)
})
})
}) })
...@@ -7,6 +7,7 @@ import { ...@@ -7,6 +7,7 @@ import {
renderViaHTTP, renderViaHTTP,
findPort, findPort,
launchApp, launchApp,
nextBuild,
killApp, killApp,
check, check,
} from 'next-test-utils' } from 'next-test-utils'
...@@ -78,4 +79,50 @@ describe('TypeScript Features', () => { ...@@ -78,4 +79,50 @@ describe('TypeScript Features', () => {
expect(found).toBe(true) expect(found).toBe(true)
}) })
}) })
describe('should build', () => {
beforeAll(async () => {
await nextBuild(appDir)
})
it('should trace correctly', async () => {
const singleAliasTrace = await fs.readJSON(
join(appDir, '.next/server/pages/single-alias.js.nft.json')
)
const wildcardAliasTrace = await fs.readJSON(
join(appDir, '.next/server/pages/wildcard-alias.js.nft.json')
)
const resolveOrderTrace = await fs.readJSON(
join(appDir, '.next/server/pages/resolve-order.js.nft.json')
)
const resolveFallbackTrace = await fs.readJSON(
join(appDir, '.next/server/pages/resolve-fallback.js.nft.json')
)
const basicAliasTrace = await fs.readJSON(
join(appDir, '.next/server/pages/basic-alias.js.nft.json')
)
expect(
singleAliasTrace.files.some((file) =>
file.includes('components/hello.js')
)
).toBe(true)
expect(
wildcardAliasTrace.files.some((file) =>
file.includes('mypackage/myfile.js')
)
).toBe(true)
expect(
resolveOrderTrace.files.some((file) => file.includes('lib/a/api.js'))
).toBe(true)
expect(
resolveFallbackTrace.files.some((file) =>
file.includes('lib/b/b-only.js')
)
).toBe(true)
expect(
basicAliasTrace.files.some((file) =>
file.includes('components/world.js')
)
).toBe(true)
})
})
}) })
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment