Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
CoCo_Code_Op2
next.js
提交
3b382a08
N
next.js
项目概览
CoCo_Code_Op2
/
next.js
与 Fork 源项目一致
从无法访问的项目Fork
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
N
next.js
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
未验证
提交
3b382a08
编写于
5月 18, 2020
作者:
J
Jan Potoms
提交者:
GitHub
5月 18, 2020
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Improve jsconfig.json error message (#13053)
上级
f5c8b428
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
55 addition
and
1 deletion
+55
-1
packages/next/build/webpack-config.ts
packages/next/build/webpack-config.ts
+11
-1
packages/next/package.json
packages/next/package.json
+2
-0
test/integration/jsconfig/jsconfig.json
test/integration/jsconfig/jsconfig.json
+1
-0
test/integration/jsconfig/pages/hello.js
test/integration/jsconfig/pages/hello.js
+1
-0
test/integration/jsconfig/test/index.test.js
test/integration/jsconfig/test/index.test.js
+35
-0
yarn.lock
yarn.lock
+5
-0
未找到文件。
packages/next/build/webpack-config.ts
浏览文件 @
3b382a08
...
...
@@ -51,6 +51,7 @@ import WebpackConformancePlugin, {
ReactSyncScriptsConformanceCheck
,
}
from
'
./webpack/plugins/webpack-conformance-plugin
'
import
{
WellKnownErrorsPlugin
}
from
'
./webpack/plugins/wellknown-errors-plugin
'
import
{
codeFrameColumns
}
from
'
@babel/code-frame
'
type
ExcludesFalse
=
<
T
>
(
x
:
T
|
false
)
=>
x
is
T
...
...
@@ -65,7 +66,16 @@ const escapePathVariables = (value: any) => {
function
parseJsonFile
(
path
:
string
)
{
const
JSON5
=
require
(
'
next/dist/compiled/json5
'
)
const
contents
=
readFileSync
(
path
)
return
JSON5
.
parse
(
contents
)
try
{
return
JSON5
.
parse
(
contents
)
}
catch
(
err
)
{
const
codeFrame
=
codeFrameColumns
(
String
(
contents
),
{
start
:
{
line
:
err
.
lineNumber
,
column
:
err
.
columnNumber
}
},
{
message
:
err
.
message
,
highlightCode
:
true
}
)
throw
new
Error
(
`Failed to parse "
${
path
}
":\n
${
codeFrame
}
`
)
}
}
function
getOptimizedAliases
(
isServer
:
boolean
):
{
[
pkg
:
string
]:
string
}
{
...
...
packages/next/package.json
浏览文件 @
3b382a08
...
...
@@ -59,6 +59,7 @@
},
"dependencies"
:
{
"@ampproject/toolbox-optimizer"
:
"2.3.1"
,
"@babel/code-frame"
:
"7.8.3"
,
"@babel/core"
:
"7.7.7"
,
"@babel/plugin-proposal-class-properties"
:
"7.8.3"
,
"@babel/plugin-proposal-nullish-coalescing-operator"
:
"7.8.3"
,
...
...
@@ -119,6 +120,7 @@
"@taskr/esnext"
:
"1.1.0"
,
"@taskr/watch"
:
"1.1.0"
,
"@types/amphtml-validator"
:
"1.0.0"
,
"@types/babel__code-frame"
:
"7.0.1"
,
"@types/babel__core"
:
"7.1.7"
,
"@types/babel__generator"
:
"7.6.1"
,
"@types/babel__template"
:
"7.0.2"
,
...
...
test/integration/jsconfig/jsconfig.json
0 → 100644
浏览文件 @
3b382a08
{}
test/integration/jsconfig/pages/hello.js
0 → 100644
浏览文件 @
3b382a08
export
default
()
=>
<
div
>
hello
world
<
/div
>
test/integration/jsconfig/test/index.test.js
0 → 100644
浏览文件 @
3b382a08
/* eslint-env jest */
import
fs
from
'
fs-extra
'
import
{
join
}
from
'
path
'
import
{
nextBuild
}
from
'
next-test-utils
'
jest
.
setTimeout
(
1000
*
60
*
2
)
const
appDir
=
join
(
__dirname
,
'
..
'
)
describe
(
'
jsconfig.json
'
,
()
=>
{
it
(
'
should build normally
'
,
async
()
=>
{
const
res
=
await
await
nextBuild
(
appDir
,
[],
{
stdout
:
true
})
expect
(
res
.
stdout
).
toMatch
(
/Compiled successfully
\.
/
)
})
it
(
'
should fail on invalid jsconfig.json
'
,
async
()
=>
{
const
jsconfigPath
=
join
(
appDir
,
'
jsconfig.json
'
)
const
originalJsconfig
=
await
fs
.
readFile
(
jsconfigPath
,
{
encoding
:
'
utf-8
'
,
})
await
fs
.
writeFile
(
jsconfigPath
,
'
{
'
,
{
encoding
:
'
utf-8
'
,
})
try
{
const
res
=
await
nextBuild
(
appDir
,
[],
{
stderr
:
true
})
expect
(
res
.
stderr
).
toMatch
(
/Error: Failed to parse "/
)
expect
(
res
.
stderr
).
toMatch
(
/JSON5: invalid end of input at 1:2/
)
}
finally
{
await
fs
.
writeFile
(
jsconfigPath
,
originalJsconfig
,
{
encoding
:
'
utf-8
'
,
})
}
})
})
yarn.lock
浏览文件 @
3b382a08
...
...
@@ -2689,6 +2689,11 @@
resolved "https://registry.yarnpkg.com/@types/anymatch/-/anymatch-1.3.1.tgz#336badc1beecb9dacc38bea2cf32adf627a8421a"
integrity sha512-/+CRPXpBDpo2RK9C68N3b2cOvO0Cf5B9aPijHsoDQTHivnGSObdOF2BRQOYjojWTDy6nQvMjmqRXIxH55VjxxA==
"@types/babel__code-frame@7.0.1":
version "7.0.1"
resolved "https://registry.yarnpkg.com/@types/babel__code-frame/-/babel__code-frame-7.0.1.tgz#baf2529c4abbfb5e4008c845efcfe39a187e2f99"
integrity sha512-FFfbQozKxYmOnCKFYV+EQprjBI7u2yaNc2ly/K9AhzyC8MzXtCtSRqptpw+HUJxhwCOo5mLwf1ATmzyhOaVbDg==
"@types/babel__core@7.1.7", "@types/babel__core@^7.1.7":
version "7.1.7"
resolved "https://registry.yarnpkg.com/@types/babel__core/-/babel__core-7.1.7.tgz#1dacad8840364a57c98d0dd4855c6dd3752c6b89"
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录