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
023863d9
Unverified
Commit
023863d9
authored
Oct 07, 2019
by
Joe Haddad
Committed by
GitHub
Oct 07, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Revert "Remove `config` export (#8895)" (#8982)
This reverts commit
67f7cf56
.
parent
004319fa
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
3 additions
and
40 deletions
+3
-40
next-page-config.ts
packages/next/build/babel/plugins/next-page-config.ts
+3
-19
next.config.js
test/integration/page-config/next.config.js
+0
-1
check-client-remove.js
test/integration/page-config/pages/check-client-remove.js
+0
-10
index.test.js
test/integration/page-config/test/index.test.js
+0
-10
No files found.
packages/next/build/babel/plugins/next-page-config.ts
View file @
023863d9
...
@@ -55,18 +55,11 @@ export default function nextPageConfig({
...
@@ -55,18 +55,11 @@ export default function nextPageConfig({
path
:
NodePath
<
BabelTypes
.
ExportNamedDeclaration
>
,
path
:
NodePath
<
BabelTypes
.
ExportNamedDeclaration
>
,
state
:
any
state
:
any
)
{
)
{
// Skip if the file will be dropped
if
(
state
.
bundleDropped
||
!
path
.
node
.
declaration
)
{
if
(
state
.
bundleDropped
)
{
return
return
}
}
// Bail out of `export { a, b, c };` case.
// We should probably support this.
if
(
!
path
.
node
.
declaration
)
{
return
}
const
{
declarations
,
id
}
=
path
.
node
.
declaration
as
any
const
{
declarations
,
id
}
=
path
.
node
.
declaration
as
any
const
config
:
PageConfig
=
{}
// drop SSR Exports for client bundles
// drop SSR Exports for client bundles
if
(
if
(
...
@@ -85,11 +78,7 @@ export default function nextPageConfig({
...
@@ -85,11 +78,7 @@ export default function nextPageConfig({
if
(
!
declarations
)
{
if
(
!
declarations
)
{
return
return
}
}
for
(
const
declaration
of
declarations
)
{
const
config
:
PageConfig
=
{}
for
(
let
dIndex
=
0
;
dIndex
<
declarations
.
length
;
++
dIndex
)
{
const
declaration
=
declarations
[
dIndex
]
if
(
declaration
.
id
.
name
!==
'config'
)
{
if
(
declaration
.
id
.
name
!==
'config'
)
{
continue
continue
}
}
...
@@ -113,11 +102,6 @@ export default function nextPageConfig({
...
@@ -113,11 +102,6 @@ export default function nextPageConfig({
config
[
name
]
=
prop
.
value
.
value
config
[
name
]
=
prop
.
value
.
value
}
}
}
}
declarations
.
splice
(
dIndex
,
1
)
if
(
declarations
.
length
===
0
)
{
path
.
remove
()
}
}
}
if
(
config
.
amp
===
true
)
{
if
(
config
.
amp
===
true
)
{
...
...
test/integration/page-config/next.config.js
deleted
100644 → 0
View file @
004319fa
module
.
exports
=
{
generateBuildId
:
()
=>
'test-page-config'
}
test/integration/page-config/pages/check-client-remove.js
deleted
100644 → 0
View file @
004319fa
import
{
config
as
hello
}
from
'../something'
import
{
config
as
world
}
from
'../config'
export
const
config
=
{
_unknownKey
:
'THIS_VALUE_SHOULD_BE_GONE'
}
export
default
()
=>
(
<
p
>
{
hello
}
{
world
}
<
/p
>
)
test/integration/page-config/test/index.test.js
View file @
023863d9
...
@@ -13,16 +13,6 @@ describe('Page Config', () => {
...
@@ -13,16 +13,6 @@ describe('Page Config', () => {
it
(
'builds without error when export const config is used outside page'
,
async
()
=>
{
it
(
'builds without error when export const config is used outside page'
,
async
()
=>
{
const
{
stderr
}
=
await
nextBuild
(
appDir
,
undefined
,
{
stderr
:
true
})
const
{
stderr
}
=
await
nextBuild
(
appDir
,
undefined
,
{
stderr
:
true
})
expect
(
stderr
).
not
.
toMatch
(
/Failed to compile
\.
/
)
expect
(
stderr
).
not
.
toMatch
(
/Failed to compile
\.
/
)
const
clientFileOutput
=
await
fs
.
readFile
(
join
(
appDir
,
'.next/static/test-page-config'
,
'pages/check-client-remove.js'
),
'utf8'
)
expect
(
clientFileOutput
).
not
.
toMatch
(
'THIS_VALUE_SHOULD_BE_GONE'
)
})
})
it
(
'shows valid error on invalid page config'
,
async
()
=>
{
it
(
'shows valid error on invalid page config'
,
async
()
=>
{
...
...
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