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
6d6ce94f
Unverified
Commit
6d6ce94f
authored
May 18, 2020
by
Joe Haddad
Committed by
GitHub
May 18, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
An empty `jsconfig.json` should not fail the build (#13051)
parent
3b382a08
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
33 additions
and
1 deletion
+33
-1
webpack-config.ts
packages/next/build/webpack-config.ts
+7
-1
jsconfig.json
test/integration/jsconfig-empty/jsconfig.json
+0
-0
next.config.js
test/integration/jsconfig-empty/next.config.js
+6
-0
index.js
test/integration/jsconfig-empty/pages/index.js
+3
-0
index.test.js
test/integration/jsconfig-empty/test/index.test.js
+17
-0
No files found.
packages/next/build/webpack-config.ts
View file @
6d6ce94f
...
@@ -65,7 +65,13 @@ const escapePathVariables = (value: any) => {
...
@@ -65,7 +65,13 @@ const escapePathVariables = (value: any) => {
function
parseJsonFile
(
path
:
string
)
{
function
parseJsonFile
(
path
:
string
)
{
const
JSON5
=
require
(
'next/dist/compiled/json5'
)
const
JSON5
=
require
(
'next/dist/compiled/json5'
)
const
contents
=
readFileSync
(
path
)
const
contents
=
readFileSync
(
path
,
'utf8'
)
// Special case an empty file
if
(
contents
.
trim
()
===
''
)
{
return
{}
}
try
{
try
{
return
JSON5
.
parse
(
contents
)
return
JSON5
.
parse
(
contents
)
}
catch
(
err
)
{
}
catch
(
err
)
{
...
...
test/integration/jsconfig-empty/jsconfig.json
0 → 100644
View file @
6d6ce94f
test/integration/jsconfig-empty/next.config.js
0 → 100644
View file @
6d6ce94f
module
.
exports
=
{
onDemandEntries
:
{
// Make sure entries are not getting disposed.
maxInactiveAge
:
1000
*
60
*
60
,
},
}
test/integration/jsconfig-empty/pages/index.js
0 → 100644
View file @
6d6ce94f
export
default
function
Abc
()
{
return
<
div
/>
}
test/integration/jsconfig-empty/test/index.test.js
0 → 100644
View file @
6d6ce94f
/* eslint-env jest */
import
{
nextBuild
}
from
'next-test-utils'
import
{
join
}
from
'path'
jest
.
setTimeout
(
1000
*
60
*
2
)
const
appDir
=
join
(
__dirname
,
'..'
)
describe
(
'Empty JSConfig Support'
,
()
=>
{
test
(
'should compile successfully'
,
async
()
=>
{
const
{
code
,
stdout
}
=
await
nextBuild
(
appDir
,
[],
{
stdout
:
true
,
})
expect
(
code
).
toBe
(
0
)
expect
(
stdout
).
toMatch
(
/Compiled successfully/
)
})
})
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