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
3c95f21d
Commit
3c95f21d
authored
May 23, 2017
by
Arunoda Susiripala
Committed by
Guillermo Rauch
May 23, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Do not try to server unnessesary files in either dev or prod. (#2048)
parent
d36118ab
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
0 deletions
+13
-0
index.js
server/index.js
+13
-0
No files found.
server/index.js
View file @
3c95f21d
...
...
@@ -100,24 +100,32 @@ export default class Server {
},
'/_next/:hash/manifest.js'
:
async
(
req
,
res
,
params
)
=>
{
if
(
!
this
.
dev
)
return
this
.
send404
(
res
)
this
.
handleBuildHash
(
'manifest.js'
,
params
.
hash
,
res
)
const
p
=
join
(
this
.
dir
,
`
${
this
.
dist
}
/manifest.js`
)
await
this
.
serveStatic
(
req
,
res
,
p
)
},
'/_next/:hash/main.js'
:
async
(
req
,
res
,
params
)
=>
{
if
(
!
this
.
dev
)
return
this
.
send404
(
res
)
this
.
handleBuildHash
(
'main.js'
,
params
.
hash
,
res
)
const
p
=
join
(
this
.
dir
,
`
${
this
.
dist
}
/main.js`
)
await
this
.
serveStatic
(
req
,
res
,
p
)
},
'/_next/:hash/commons.js'
:
async
(
req
,
res
,
params
)
=>
{
if
(
!
this
.
dev
)
return
this
.
send404
(
res
)
this
.
handleBuildHash
(
'commons.js'
,
params
.
hash
,
res
)
const
p
=
join
(
this
.
dir
,
`
${
this
.
dist
}
/commons.js`
)
await
this
.
serveStatic
(
req
,
res
,
p
)
},
'/_next/:hash/app.js'
:
async
(
req
,
res
,
params
)
=>
{
if
(
this
.
dev
)
return
this
.
send404
(
res
)
this
.
handleBuildHash
(
'app.js'
,
params
.
hash
,
res
)
const
p
=
join
(
this
.
dir
,
`
${
this
.
dist
}
/app.js`
)
await
this
.
serveStatic
(
req
,
res
,
p
)
...
...
@@ -341,4 +349,9 @@ export default class Server {
res
.
setHeader
(
'Cache-Control'
,
'max-age=365000000, immutable'
)
}
send404
(
res
)
{
res
.
statusCode
=
404
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