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
841cd6c4
Unverified
Commit
841cd6c4
authored
Apr 14, 2020
by
Joe Haddad
Committed by
GitHub
Apr 14, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix Situation Where Build Can Hang Indefinitely (#11881)
parent
4e6d6d20
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
32 additions
and
8 deletions
+32
-8
TaskRunner.js
...d/webpack/plugins/terser-webpack-plugin/src/TaskRunner.js
+26
-5
index.js
.../build/webpack/plugins/terser-webpack-plugin/src/index.js
+6
-3
No files found.
packages/next/build/webpack/plugins/terser-webpack-plugin/src/TaskRunner.js
View file @
841cd6c4
...
@@ -57,8 +57,16 @@ export default class TaskRunner {
...
@@ -57,8 +57,16 @@ export default class TaskRunner {
const
done
=
()
=>
step
(
index
,
result
)
const
done
=
()
=>
step
(
index
,
result
)
if
(
cachePath
)
{
if
(
cachePath
)
{
writeFileP
(
cachePath
,
JSON
.
stringify
(
result
),
'utf8'
)
writeFileP
(
cachePath
,
JSON
.
stringify
(
result
),
'utf8'
)
.
then
(
done
)
// This is important to stay as `.then(fn1, fn2)` and not
.
catch
(
done
)
// `.then(fn1).catch(fn2)` so that we don't double-invoke `step`
// when `done` emits an error.
.
then
(
done
,
done
)
.
catch
(
err
=>
{
// Abort task on internal error (`done` failed). This can
// happen when users have a bad `package-lock.json` with an
// invalid webpack version, etc:
callback
(
err
)
})
}
}
}
catch
(
error
)
{
}
catch
(
error
)
{
step
(
index
,
{
error
})
step
(
index
,
{
error
})
...
@@ -66,9 +74,22 @@ export default class TaskRunner {
...
@@ -66,9 +74,22 @@ export default class TaskRunner {
}
}
if
(
this
.
cacheDir
)
{
if
(
this
.
cacheDir
)
{
readFileP
(
cachePath
,
'utf8'
)
// This is important to stay as `.then(fn1, fn2)` and not
.
then
(
data
=>
step
(
index
,
JSON
.
parse
(
data
)))
// `.then(fn1).catch(fn2)` so that we don't double-invoke `step` when
.
catch
(()
=>
enqueue
())
// `step` emits an error.
readFileP
(
cachePath
,
'utf8'
).
then
(
data
=>
{
try
{
step
(
index
,
JSON
.
parse
(
data
))
}
catch
(
err
)
{
// Abort task on internal error (`done` failed). This can happen
// when users have a bad `package-lock.json` with an invalid
// webpack version, etc:
callback
(
err
)
}
},
()
=>
enqueue
()
)
}
else
{
}
else
{
enqueue
()
enqueue
()
}
}
...
...
packages/next/build/webpack/plugins/terser-webpack-plugin/src/index.js
View file @
841cd6c4
...
@@ -4,7 +4,7 @@
...
@@ -4,7 +4,7 @@
import
stringHash
from
'next/dist/compiled/string-hash'
import
stringHash
from
'next/dist/compiled/string-hash'
import
{
SourceMapConsumer
}
from
'next/dist/compiled/source-map'
import
{
SourceMapConsumer
}
from
'next/dist/compiled/source-map'
import
{
SourceMapSource
,
RawSource
}
from
'webpack-sources'
import
{
SourceMapSource
,
RawSource
}
from
'webpack-sources'
import
{
RequestShortener
}
from
'webpack
'
import
RequestShortener
from
'webpack/lib/RequestShortener
'
import
TaskRunner
from
'./TaskRunner'
import
TaskRunner
from
'./TaskRunner'
const
warningRegex
=
/
\[
.+:
([
0-9
]
+
)
,
([
0-9
]
+
)\]
/
const
warningRegex
=
/
\[
.+:
([
0-9
]
+
)
,
([
0-9
]
+
)\]
/
...
@@ -204,8 +204,11 @@ export class TerserPlugin {
...
@@ -204,8 +204,11 @@ export class TerserPlugin {
taskRunner
.
run
(
tasks
,
(
tasksError
,
results
)
=>
{
taskRunner
.
run
(
tasks
,
(
tasksError
,
results
)
=>
{
if
(
tasksError
)
{
if
(
tasksError
)
{
compilation
.
errors
.
push
(
tasksError
)
try
{
taskRunner
.
exit
()
}
finally
{
callback
(
tasksError
)
}
return
return
}
}
...
...
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