Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
CoCo_Code_Op2
next.js
提交
5f311cdd
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,发现更多精彩内容 >>
未验证
提交
5f311cdd
编写于
12月 28, 2020
作者:
J
Joe Haddad
提交者:
GitHub
12月 28, 2020
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix Fast Refresh tests with webpack@5 (#20543)
上级
f02bf210
变更
3
显示空白变更内容
内联
并排
Showing
3 changed file
with
47 addition
and
36 deletion
+47
-36
.github/workflows/build_test_deploy.yml
.github/workflows/build_test_deploy.yml
+1
-1
packages/next/build/webpack-config.ts
packages/next/build/webpack-config.ts
+1
-0
packages/next/build/webpack/plugins/font-stylesheet-gathering-plugin.ts
...build/webpack/plugins/font-stylesheet-gathering-plugin.ts
+45
-35
未找到文件。
.github/workflows/build_test_deploy.yml
浏览文件 @
5f311cdd
...
...
@@ -148,7 +148,7 @@ jobs:
steps
:
-
uses
:
actions/checkout@v2
-
run
:
git fetch --depth=1 origin +refs/tags/*:refs/tags/*
-
run
:
cat package.json | jq '.resolutions.webpack = "^5.
0.0-beta.30
"' > package.json.tmp && mv package.json.tmp package.json
-
run
:
cat package.json | jq '.resolutions.webpack = "^5.
11.1
"' > package.json.tmp && mv package.json.tmp package.json
-
run
:
cat package.json | jq '.resolutions.react = "^17.0.1"' > package.json.tmp && mv package.json.tmp package.json
-
run
:
cat package.json | jq '.resolutions."react-dom" = "^17.0.1"' > package.json.tmp && mv package.json.tmp package.json
-
run
:
yarn install --check-files
...
...
packages/next/build/webpack-config.ts
浏览文件 @
5f311cdd
...
...
@@ -1131,6 +1131,7 @@ export default async function getBaseWebpackConfig(
if
(
!
webpackConfig
.
optimization
)
{
webpackConfig
.
optimization
=
{}
}
webpackConfig
.
optimization
.
providedExports
=
false
webpackConfig
.
optimization
.
usedExports
=
false
}
...
...
packages/next/build/webpack/plugins/font-stylesheet-gathering-plugin.ts
浏览文件 @
5f311cdd
...
...
@@ -71,12 +71,12 @@ export class FontStylesheetGatheringPlugin {
return
}
let
result
if
(
node
.
name
===
'
__jsx
'
)
{
if
(
node
.
name
===
'
_
jsx
'
||
node
.
name
===
'
_
_jsx
'
)
{
result
=
new
BasicEvaluatedExpression
()
// @ts-ignore
result
.
setRange
(
node
.
range
)
result
.
setExpression
(
node
)
result
.
setIdentifier
(
'
__jsx
'
)
result
.
setIdentifier
(
node
.
name
)
// This was added webpack 5.
if
(
isWebpack5
)
{
...
...
@@ -86,9 +86,7 @@ export class FontStylesheetGatheringPlugin {
return
result
})
parser
.
hooks
.
call
.
for
(
'
__jsx
'
)
.
tap
(
this
.
constructor
.
name
,
(
node
:
namedTypes
.
CallExpression
)
=>
{
const
jsxNodeHandler
=
(
node
:
namedTypes
.
CallExpression
)
=>
{
if
(
node
.
arguments
.
length
!==
2
)
{
// A font link tag has only two arguments rel=stylesheet and href='...'
return
...
...
@@ -123,7 +121,15 @@ export class FontStylesheetGatheringPlugin {
}
this
.
gatheredStylesheets
.
push
(
props
.
href
)
})
}
// React JSX transform:
parser
.
hooks
.
call
.
for
(
'
_jsx
'
)
.
tap
(
this
.
constructor
.
name
,
jsxNodeHandler
)
// Next.js JSX transform:
parser
.
hooks
.
call
.
for
(
'
__jsx
'
)
.
tap
(
this
.
constructor
.
name
,
jsxNodeHandler
)
})
}
}
...
...
@@ -213,6 +219,10 @@ function isNodeCreatingLinkElement(node: namedTypes.CallExpression) {
if
(
componentNode
.
type
!==
'
Literal
'
)
{
return
false
}
// React has pragma: _jsx.
// Next has pragma: __jsx.
return
callee
.
name
===
'
__jsx
'
&&
componentNode
.
value
===
'
link
'
return
(
(
callee
.
name
===
'
_jsx
'
||
callee
.
name
===
'
__jsx
'
)
&&
componentNode
.
value
===
'
link
'
)
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录