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
b0b1c320
Commit
b0b1c320
authored
Jul 08, 2019
by
Joe Haddad
Committed by
Tim Neutkens
Jul 08, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Experimentalize `public/` (#7771)
* Experimentalize `public/` * Update tests for publicDirectory config
parent
f2049352
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
25 additions
and
4 deletions
+25
-4
config.ts
packages/next-server/server/config.ts
+1
-0
next-server.ts
packages/next-server/server/next-server.ts
+4
-1
next-dev-server.js
packages/next/server/next-dev-server.js
+8
-3
next.config.js
test/integration/basic/next.config.js
+3
-0
next.config.js
test/integration/export/next.config.js
+3
-0
next.config.js
test/integration/production/next.config.js
+3
-0
next.config.js
test/integration/serverless/next.config.js
+3
-0
No files found.
packages/next-server/server/config.ts
View file @
b0b1c320
...
@@ -37,6 +37,7 @@ const defaultConfig: { [key: string]: any } = {
...
@@ -37,6 +37,7 @@ const defaultConfig: { [key: string]: any } = {
flyingShuttle
:
false
,
flyingShuttle
:
false
,
asyncToPromises
:
false
,
asyncToPromises
:
false
,
documentMiddleware
:
false
,
documentMiddleware
:
false
,
publicDirectory
:
false
,
},
},
}
}
...
...
packages/next-server/server/next-server.ts
View file @
b0b1c320
...
@@ -236,7 +236,10 @@ export default class Server {
...
@@ -236,7 +236,10 @@ export default class Server {
},
},
]
]
if
(
fs
.
existsSync
(
this
.
publicDir
))
{
if
(
this
.
nextConfig
.
experimental
.
publicDirectory
&&
fs
.
existsSync
(
this
.
publicDir
)
)
{
routes
.
push
(...
this
.
generatePublicRoutes
())
routes
.
push
(...
this
.
generatePublicRoutes
())
}
}
...
...
packages/next/server/next-dev-server.js
View file @
b0b1c320
...
@@ -271,9 +271,14 @@ export default class DevServer extends Server {
...
@@ -271,9 +271,14 @@ export default class DevServer extends Server {
})
})
}
catch
(
err
)
{
}
catch
(
err
)
{
if
(
err
.
code
===
'ENOENT'
)
{
if
(
err
.
code
===
'ENOENT'
)
{
// Try to send a public file and let servePublic handle the request from here
if
(
this
.
nextConfig
.
experimental
.
publicDirectory
)
{
await
this
.
servePublic
(
req
,
res
,
pathname
)
// Try to send a public file and let servePublic handle the request from here
return
null
await
this
.
servePublic
(
req
,
res
,
pathname
)
return
null
}
else
{
res
.
statusCode
=
404
return
this
.
renderErrorToHTML
(
null
,
req
,
res
,
pathname
,
query
)
}
}
}
if
(
!
this
.
quiet
)
console
.
error
(
err
)
if
(
!
this
.
quiet
)
console
.
error
(
err
)
}
}
...
...
test/integration/basic/next.config.js
View file @
b0b1c320
...
@@ -4,6 +4,9 @@ module.exports = {
...
@@ -4,6 +4,9 @@ module.exports = {
// Make sure entries are not getting disposed.
// Make sure entries are not getting disposed.
maxInactiveAge
:
1000
*
60
*
60
maxInactiveAge
:
1000
*
60
*
60
},
},
experimental
:
{
publicDirectory
:
true
},
webpack
(
config
)
{
webpack
(
config
)
{
config
.
module
.
rules
.
push
({
config
.
module
.
rules
.
push
({
test
:
/pages
[\\/]
hmr
[\\/]
about/
,
test
:
/pages
[\\/]
hmr
[\\/]
about/
,
...
...
test/integration/export/next.config.js
View file @
b0b1c320
...
@@ -9,6 +9,9 @@ module.exports = phase => {
...
@@ -9,6 +9,9 @@ module.exports = phase => {
serverRuntimeConfig
:
{
serverRuntimeConfig
:
{
bar
:
'bar'
bar
:
'bar'
},
},
experimental
:
{
publicDirectory
:
true
},
exportTrailingSlash
:
true
,
exportTrailingSlash
:
true
,
exportPathMap
:
function
()
{
exportPathMap
:
function
()
{
return
{
return
{
...
...
test/integration/production/next.config.js
View file @
b0b1c320
...
@@ -2,5 +2,8 @@ module.exports = {
...
@@ -2,5 +2,8 @@ module.exports = {
onDemandEntries
:
{
onDemandEntries
:
{
// Make sure entries are not getting disposed.
// Make sure entries are not getting disposed.
maxInactiveAge
:
1000
*
60
*
60
maxInactiveAge
:
1000
*
60
*
60
},
experimental
:
{
publicDirectory
:
true
}
}
}
}
test/integration/serverless/next.config.js
View file @
b0b1c320
...
@@ -3,5 +3,8 @@ module.exports = {
...
@@ -3,5 +3,8 @@ module.exports = {
onDemandEntries
:
{
onDemandEntries
:
{
// Make sure entries are not getting disposed.
// Make sure entries are not getting disposed.
maxInactiveAge
:
1000
*
60
*
60
maxInactiveAge
:
1000
*
60
*
60
},
experimental
:
{
publicDirectory
:
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