Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
N
next.js
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Alex
next.js
Commits
73fbd698
Unverified
Commit
73fbd698
authored
Oct 25, 2021
by
JJ Kasper
Committed by
GitHub
Oct 25, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix trace case with tsconfig/jsconfig baseUrl (#30286)
parent
0910e8b8
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
67 additions
and
0 deletions
+67
-0
next-trace-entrypoints-plugin.ts
...xt/build/webpack/plugins/next-trace-entrypoints-plugin.ts
+2
-0
index.test.js
test/integration/jsconfig-baseurl/test/index.test.js
+18
-0
index.test.js
test/integration/jsconfig-paths/test/index.test.js
+47
-0
No files found.
packages/next/build/webpack/plugins/next-trace-entrypoints-plugin.ts
View file @
73fbd698
...
@@ -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
,
}
}
...
...
test/integration/jsconfig-baseurl/test/index.test.js
View file @
73fbd698
...
@@ -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
)
})
})
})
})
test/integration/jsconfig-paths/test/index.test.js
View file @
73fbd698
...
@@ -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
)
})
})
})
})
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment