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
40d926d7
Commit
40d926d7
authored
Mar 08, 2018
by
Tomas Roos
Committed by
Tim Neutkens
Mar 08, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Expose main.js.map (#3969)
parent
ae07cbae
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
21 additions
and
15 deletions
+21
-15
index.js
server/index.js
+21
-15
No files found.
server/index.js
View file @
40d926d7
...
@@ -158,21 +158,21 @@ export default class Server {
...
@@ -158,21 +158,21 @@ export default class Server {
await
this
.
serveStatic
(
req
,
res
,
p
)
await
this
.
serveStatic
(
req
,
res
,
p
)
},
},
'/_next/:
hash
/manifest.js'
:
async
(
req
,
res
,
params
)
=>
{
'/_next/:
buildId
/manifest.js'
:
async
(
req
,
res
,
params
)
=>
{
if
(
!
this
.
dev
)
return
this
.
send404
(
res
)
if
(
!
this
.
dev
)
return
this
.
send404
(
res
)
this
.
handleBuild
Hash
(
'manifest.js'
,
params
.
hash
,
res
)
this
.
handleBuild
Id
(
params
.
buildId
,
res
)
const
p
=
join
(
this
.
dir
,
this
.
dist
,
'manifest.js'
)
const
p
=
join
(
this
.
dir
,
this
.
dist
,
'manifest.js'
)
await
this
.
serveStatic
(
req
,
res
,
p
)
await
this
.
serveStatic
(
req
,
res
,
p
)
},
},
'/_next/:
hash
/main.js'
:
async
(
req
,
res
,
params
)
=>
{
'/_next/:
buildId
/main.js'
:
async
(
req
,
res
,
params
)
=>
{
if
(
this
.
dev
)
{
if
(
this
.
dev
)
{
this
.
handleBuild
Hash
(
'main.js'
,
params
.
hash
,
res
)
this
.
handleBuild
Id
(
params
.
buildId
,
res
)
const
p
=
join
(
this
.
dir
,
this
.
dist
,
'main.js'
)
const
p
=
join
(
this
.
dir
,
this
.
dist
,
'main.js'
)
await
this
.
serveStatic
(
req
,
res
,
p
)
await
this
.
serveStatic
(
req
,
res
,
p
)
}
else
{
}
else
{
const
buildId
=
params
.
hash
const
buildId
=
params
.
buildId
if
(
!
this
.
handleBuildId
(
buildId
,
res
))
{
if
(
!
this
.
handleBuildId
(
buildId
,
res
))
{
const
error
=
new
Error
(
'INVALID_BUILD_ID'
)
const
error
=
new
Error
(
'INVALID_BUILD_ID'
)
const
customFields
=
{
buildIdMismatched
:
true
}
const
customFields
=
{
buildIdMismatched
:
true
}
...
@@ -185,6 +185,22 @@ export default class Server {
...
@@ -185,6 +185,22 @@ export default class Server {
}
}
},
},
'/_next/:buildId/main.js.map'
:
async
(
req
,
res
,
params
)
=>
{
if
(
this
.
dev
)
{
this
.
handleBuildId
(
params
.
buildId
,
res
)
const
p
=
join
(
this
.
dir
,
this
.
dist
,
'main.js.map'
)
await
this
.
serveStatic
(
req
,
res
,
p
)
}
else
{
const
buildId
=
params
.
buildId
if
(
!
this
.
handleBuildId
(
buildId
,
res
))
{
return
await
this
.
render404
(
req
,
res
)
}
const
p
=
join
(
this
.
dir
,
this
.
dist
,
'main.js.map'
)
await
this
.
serveStatic
(
req
,
res
,
p
)
}
},
'/_next/:buildId/page/:path*.js.map'
:
async
(
req
,
res
,
params
)
=>
{
'/_next/:buildId/page/:path*.js.map'
:
async
(
req
,
res
,
params
)
=>
{
const
paths
=
params
.
path
||
[
''
]
const
paths
=
params
.
path
||
[
''
]
const
page
=
`/
${
paths
.
join
(
'/'
)}
`
const
page
=
`/
${
paths
.
join
(
'/'
)}
`
...
@@ -452,16 +468,6 @@ export default class Server {
...
@@ -452,16 +468,6 @@ export default class Server {
return
Array
.
from
(
errors
.
values
())[
0
][
0
]
return
Array
.
from
(
errors
.
values
())[
0
][
0
]
}
}
handleBuildHash
(
filename
,
hash
,
res
)
{
if
(
this
.
dev
)
{
res
.
setHeader
(
'Cache-Control'
,
'no-store, must-revalidate'
)
return
true
}
res
.
setHeader
(
'Cache-Control'
,
'max-age=31536000, immutable'
)
return
true
}
send404
(
res
)
{
send404
(
res
)
{
res
.
statusCode
=
404
res
.
statusCode
=
404
res
.
end
(
'404 - Not Found'
)
res
.
end
(
'404 - Not Found'
)
...
...
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