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
bf097f1d
Unverified
Commit
bf097f1d
authored
Nov 05, 2021
by
JJ Kasper
Committed by
GitHub
Nov 05, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update resolving for node_modules trace pass (#30985)
* Update resolving for node_modules trace pass * Update test
parent
5db9d09e
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
29 additions
and
18 deletions
+29
-18
next-trace-entrypoints-plugin.ts
...xt/build/webpack/plugins/next-trace-entrypoints-plugin.ts
+2
-9
run-tests.js
run-tests.js
+1
-3
prerender-native-module.test.ts
test/e2e/prerender-native-module.test.ts
+3
-0
prerender.test.ts
test/e2e/prerender.test.ts
+5
-0
index.test.js
test/integration/jsconfig-baseurl/test/index.test.js
+6
-0
index.test.js
test/integration/jsconfig-paths/test/index.test.js
+6
-0
index.test.js
test/integration/production/test/index.test.js
+6
-6
No files found.
packages/next/build/webpack/plugins/next-trace-entrypoints-plugin.ts
View file @
bf097f1d
...
@@ -114,8 +114,7 @@ export class TraceEntryPointsPlugin implements webpack5.WebpackPluginInstance {
...
@@ -114,8 +114,7 @@ export class TraceEntryPointsPlugin implements webpack5.WebpackPluginInstance {
assets
:
any
,
assets
:
any
,
span
:
Span
,
span
:
Span
,
readlink
:
any
,
readlink
:
any
,
stat
:
any
,
stat
:
any
doResolve
:
any
)
{
)
{
const
outputPath
=
compilation
.
outputOptions
.
path
const
outputPath
=
compilation
.
outputOptions
.
path
...
@@ -173,11 +172,6 @@ export class TraceEntryPointsPlugin implements webpack5.WebpackPluginInstance {
...
@@ -173,11 +172,6 @@ export class TraceEntryPointsPlugin implements webpack5.WebpackPluginInstance {
},
},
readlink
,
readlink
,
stat
,
stat
,
resolve
:
doResolve
?
(
id
,
parent
,
job
,
isCjs
)
=>
{
return
doResolve
(
id
,
parent
,
job
,
!
isCjs
)
}
:
undefined
,
ignore
:
[...
TRACE_IGNORES
,
...
this
.
excludeFiles
],
ignore
:
[...
TRACE_IGNORES
,
...
this
.
excludeFiles
],
mixedModules
:
true
,
mixedModules
:
true
,
})
})
...
@@ -455,8 +449,7 @@ export class TraceEntryPointsPlugin implements webpack5.WebpackPluginInstance {
...
@@ -455,8 +449,7 @@ export class TraceEntryPointsPlugin implements webpack5.WebpackPluginInstance {
assets
,
assets
,
traceEntrypointsPluginSpan
,
traceEntrypointsPluginSpan
,
readlink
,
readlink
,
stat
,
stat
doResolve
)
)
.
then
(()
=>
callback
())
.
then
(()
=>
callback
())
.
catch
((
err
)
=>
callback
(
err
))
.
catch
((
err
)
=>
callback
(
err
))
...
...
run-tests.js
View file @
bf097f1d
...
@@ -250,11 +250,9 @@ async function main() {
...
@@ -250,11 +250,9 @@ async function main() {
...
process
.
env
,
...
process
.
env
,
// run tests in headless mode by default
// run tests in headless mode by default
HEADLESS
:
'true'
,
HEADLESS
:
'true'
,
TRACE_PLAYWRIGHT
:
'true'
,
...(
isFinalRun
...(
isFinalRun
?
{
?
{
// only trace on final run as previous traces
// are removed anyways
TRACE_PLAYWRIGHT
:
'true'
,
// Events can be finicky in CI. This switches to a more
// Events can be finicky in CI. This switches to a more
// reliable polling method.
// reliable polling method.
// CHOKIDAR_USEPOLLING: 'true',
// CHOKIDAR_USEPOLLING: 'true',
...
...
test/e2e/prerender-native-module.test.ts
View file @
bf097f1d
...
@@ -84,6 +84,9 @@ describe('prerender native module', () => {
...
@@ -84,6 +84,9 @@ describe('prerender native module', () => {
/node_modules
\/
sqlite3
\/
.*
?\.
js/
,
/node_modules
\/
sqlite3
\/
.*
?\.
js/
,
/node_modules
\/
sqlite3
\/
.*
?\.
node/
,
/node_modules
\/
sqlite3
\/
.*
?\.
node/
,
/node_modules
\/
sqlite
\/
.*
?\.
js/
,
/node_modules
\/
sqlite
\/
.*
?\.
js/
,
/node_modules
\/
next/
,
/next
\/
router
\.
js/
,
/next
\/
dist
\/
client
\/
router
\.
js/
,
/
\/
data
\.
sqlite/
,
/
\/
data
\.
sqlite/
,
],
],
notTests
:
[],
notTests
:
[],
...
...
test/e2e/prerender.test.ts
View file @
bf097f1d
...
@@ -1832,6 +1832,7 @@ describe('Prerender', () => {
...
@@ -1832,6 +1832,7 @@ describe('Prerender', () => {
/node_modules
\/
react
\/
index
\.
js/
,
/node_modules
\/
react
\/
index
\.
js/
,
/node_modules
\/
react
\/
package
\.
json/
,
/node_modules
\/
react
\/
package
\.
json/
,
/node_modules
\/
react
\/
cjs
\/
react
\.
production
\.
min
\.
js/
,
/node_modules
\/
react
\/
cjs
\/
react
\.
production
\.
min
\.
js/
,
/node_modules
\/
next/
,
],
],
notTests
:
[],
notTests
:
[],
},
},
...
@@ -1843,6 +1844,7 @@ describe('Prerender', () => {
...
@@ -1843,6 +1844,7 @@ describe('Prerender', () => {
/node_modules
\/
react
\/
index
\.
js/
,
/node_modules
\/
react
\/
index
\.
js/
,
/node_modules
\/
react
\/
package
\.
json/
,
/node_modules
\/
react
\/
package
\.
json/
,
/node_modules
\/
react
\/
cjs
\/
react
\.
production
\.
min
\.
js/
,
/node_modules
\/
react
\/
cjs
\/
react
\.
production
\.
min
\.
js/
,
/node_modules
\/
next/
,
/
\/
world.txt/
,
/
\/
world.txt/
,
],
],
notTests
:
[
notTests
:
[
...
@@ -1858,6 +1860,9 @@ describe('Prerender', () => {
...
@@ -1858,6 +1860,9 @@ describe('Prerender', () => {
/node_modules
\/
react
\/
index
\.
js/
,
/node_modules
\/
react
\/
index
\.
js/
,
/node_modules
\/
react
\/
package
\.
json/
,
/node_modules
\/
react
\/
package
\.
json/
,
/node_modules
\/
react
\/
cjs
\/
react
\.
production
\.
min
\.
js/
,
/node_modules
\/
react
\/
cjs
\/
react
\.
production
\.
min
\.
js/
,
/node_modules
\/
next/
,
/next
\/
router
\.
js/
,
/next
\/
dist
\/
client
\/
router
\.
js/
,
/node_modules
\/
@firebase
\/
firestore
\/
.*
?\.
js/
,
/node_modules
\/
@firebase
\/
firestore
\/
.*
?\.
js/
,
],
],
notTests
:
[
/
\/
world.txt/
],
notTests
:
[
/
\/
world.txt/
],
...
...
test/integration/jsconfig-baseurl/test/index.test.js
View file @
bf097f1d
...
@@ -71,6 +71,12 @@ describe('TypeScript Features', () => {
...
@@ -71,6 +71,12 @@ describe('TypeScript Features', () => {
const
helloTrace
=
await
fs
.
readJSON
(
const
helloTrace
=
await
fs
.
readJSON
(
join
(
appDir
,
'.next/server/pages/hello.js.nft.json'
)
join
(
appDir
,
'.next/server/pages/hello.js.nft.json'
)
)
)
const
appTrace
=
await
fs
.
readJSON
(
join
(
appDir
,
'.next/server/pages/_app.js.nft.json'
)
)
expect
(
appTrace
.
files
.
some
((
file
)
=>
file
.
includes
(
'node_modules/next'
))
).
toBe
(
true
)
expect
(
expect
(
helloTrace
.
files
.
some
((
file
)
=>
file
.
includes
(
'components/world.js'
))
helloTrace
.
files
.
some
((
file
)
=>
file
.
includes
(
'components/world.js'
))
).
toBe
(
true
)
).
toBe
(
true
)
...
...
test/integration/jsconfig-paths/test/index.test.js
View file @
bf097f1d
...
@@ -85,6 +85,9 @@ describe('TypeScript Features', () => {
...
@@ -85,6 +85,9 @@ describe('TypeScript Features', () => {
await
nextBuild
(
appDir
)
await
nextBuild
(
appDir
)
})
})
it
(
'should trace correctly'
,
async
()
=>
{
it
(
'should trace correctly'
,
async
()
=>
{
const
appTrace
=
await
fs
.
readJSON
(
join
(
appDir
,
'.next/server/pages/_app.js.nft.json'
)
)
const
singleAliasTrace
=
await
fs
.
readJSON
(
const
singleAliasTrace
=
await
fs
.
readJSON
(
join
(
appDir
,
'.next/server/pages/single-alias.js.nft.json'
)
join
(
appDir
,
'.next/server/pages/single-alias.js.nft.json'
)
)
)
...
@@ -100,6 +103,9 @@ describe('TypeScript Features', () => {
...
@@ -100,6 +103,9 @@ describe('TypeScript Features', () => {
const
basicAliasTrace
=
await
fs
.
readJSON
(
const
basicAliasTrace
=
await
fs
.
readJSON
(
join
(
appDir
,
'.next/server/pages/basic-alias.js.nft.json'
)
join
(
appDir
,
'.next/server/pages/basic-alias.js.nft.json'
)
)
)
expect
(
appTrace
.
files
.
some
((
file
)
=>
file
.
includes
(
'node_modules/next'
))
).
toBe
(
true
)
expect
(
expect
(
singleAliasTrace
.
files
.
some
((
file
)
=>
singleAliasTrace
.
files
.
some
((
file
)
=>
file
.
includes
(
'components/hello.js'
)
file
.
includes
(
'components/hello.js'
)
...
...
test/integration/production/test/index.test.js
View file @
bf097f1d
...
@@ -130,6 +130,7 @@ describe('Production Usage', () => {
...
@@ -130,6 +130,7 @@ describe('Production Usage', () => {
/node_modules
\/
react
\/
index
\.
js/
,
/node_modules
\/
react
\/
index
\.
js/
,
/node_modules
\/
react
\/
package
\.
json/
,
/node_modules
\/
react
\/
package
\.
json/
,
/node_modules
\/
react
\/
cjs
\/
react
\.
production
\.
min
\.
js/
,
/node_modules
\/
react
\/
cjs
\/
react
\.
production
\.
min
\.
js/
,
/node_modules
\/
next/
,
/next
\/
link
\.
js/
,
/next
\/
link
\.
js/
,
/next
\/
dist
\/
client
\/
link
\.
js/
,
/next
\/
dist
\/
client
\/
link
\.
js/
,
/next
\/
dist
\/
shared
\/
lib
\/
router
\/
utils
\/
resolve-rewrites
\.
js/
,
/next
\/
dist
\/
shared
\/
lib
\/
router
\/
utils
\/
resolve-rewrites
\.
js/
,
...
@@ -146,6 +147,7 @@ describe('Production Usage', () => {
...
@@ -146,6 +147,7 @@ describe('Production Usage', () => {
/node_modules
\/
react
\/
index
\.
js/
,
/node_modules
\/
react
\/
index
\.
js/
,
/node_modules
\/
react
\/
package
\.
json/
,
/node_modules
\/
react
\/
package
\.
json/
,
/node_modules
\/
react
\/
cjs
\/
react
\.
production
\.
min
\.
js/
,
/node_modules
\/
react
\/
cjs
\/
react
\.
production
\.
min
\.
js/
,
/node_modules
\/
next/
,
/next
\/
link
\.
js/
,
/next
\/
link
\.
js/
,
/next
\/
dist
\/
client
\/
link
\.
js/
,
/next
\/
dist
\/
client
\/
link
\.
js/
,
/next
\/
dist
\/
shared
\/
lib
\/
router
\/
utils
\/
resolve-rewrites
\.
js/
,
/next
\/
dist
\/
shared
\/
lib
\/
router
\/
utils
\/
resolve-rewrites
\.
js/
,
...
@@ -160,6 +162,7 @@ describe('Production Usage', () => {
...
@@ -160,6 +162,7 @@ describe('Production Usage', () => {
/node_modules
\/
react
\/
index
\.
js/
,
/node_modules
\/
react
\/
index
\.
js/
,
/node_modules
\/
react
\/
package
\.
json/
,
/node_modules
\/
react
\/
package
\.
json/
,
/node_modules
\/
react
\/
cjs
\/
react
\.
production
\.
min
\.
js/
,
/node_modules
\/
react
\/
cjs
\/
react
\.
production
\.
min
\.
js/
,
/node_modules
\/
next/
,
/next
\/
link
\.
js/
,
/next
\/
link
\.
js/
,
/next
\/
dist
\/
client
\/
link
\.
js/
,
/next
\/
dist
\/
client
\/
link
\.
js/
,
/next
\/
dist
\/
shared
\/
lib
\/
router
\/
utils
\/
resolve-rewrites
\.
js/
,
/next
\/
dist
\/
shared
\/
lib
\/
router
\/
utils
\/
resolve-rewrites
\.
js/
,
...
@@ -167,12 +170,7 @@ describe('Production Usage', () => {
...
@@ -167,12 +170,7 @@ describe('Production Usage', () => {
/node_modules
\/
nanoid
\/
url-alphabet
\/
index
\.
js/
,
/node_modules
\/
nanoid
\/
url-alphabet
\/
index
\.
js/
,
/node_modules
\/
es5-ext
\/
array
\/
#
\/
clear
\.
js/
,
/node_modules
\/
es5-ext
\/
array
\/
#
\/
clear
\.
js/
,
],
],
notTests
:
[
notTests
:
[
/next
\/
dist
\/
pages
\/
_error
\.
js/
,
/next
\/
error
\.
js/
,
/
\0
/
],
/node_modules
\/
nanoid
\/
index
\.
cjs/
,
/next
\/
dist
\/
pages
\/
_error
\.
js/
,
/next
\/
error
\.
js/
,
/
\0
/
,
],
},
},
{
{
page
:
'/counter'
,
page
:
'/counter'
,
...
@@ -183,6 +181,7 @@ describe('Production Usage', () => {
...
@@ -183,6 +181,7 @@ describe('Production Usage', () => {
/node_modules
\/
react
\/
package
\.
json/
,
/node_modules
\/
react
\/
package
\.
json/
,
/node_modules
\/
react
\/
cjs
\/
react
\.
production
\.
min
\.
js/
,
/node_modules
\/
react
\/
cjs
\/
react
\.
production
\.
min
\.
js/
,
/node_modules
\/
react
\/
cjs
\/
react
\.
development
\.
js/
,
/node_modules
\/
react
\/
cjs
\/
react
\.
development
\.
js/
,
/node_modules
\/
next/
,
/next
\/
router
\.
js/
,
/next
\/
router
\.
js/
,
/next
\/
dist
\/
client
\/
router
\.
js/
,
/next
\/
dist
\/
client
\/
router
\.
js/
,
/next
\/
dist
\/
shared
\/
lib
\/
router
\/
utils
\/
resolve-rewrites
\.
js/
,
/next
\/
dist
\/
shared
\/
lib
\/
router
\/
utils
\/
resolve-rewrites
\.
js/
,
...
@@ -197,6 +196,7 @@ describe('Production Usage', () => {
...
@@ -197,6 +196,7 @@ describe('Production Usage', () => {
/node_modules
\/
react
\/
index
\.
js/
,
/node_modules
\/
react
\/
index
\.
js/
,
/node_modules
\/
react
\/
package
\.
json/
,
/node_modules
\/
react
\/
package
\.
json/
,
/node_modules
\/
react
\/
cjs
\/
react
\.
production
\.
min
\.
js/
,
/node_modules
\/
react
\/
cjs
\/
react
\.
production
\.
min
\.
js/
,
/node_modules
\/
next/
,
/next
\/
link
\.
js/
,
/next
\/
link
\.
js/
,
/next
\/
dist
\/
client
\/
link
\.
js/
,
/next
\/
dist
\/
client
\/
link
\.
js/
,
/next
\/
dist
\/
shared
\/
lib
\/
router
\/
utils
\/
resolve-rewrites
\.
js/
,
/next
\/
dist
\/
shared
\/
lib
\/
router
\/
utils
\/
resolve-rewrites
\.
js/
,
...
...
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