Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
CoCo_Code_Op2
next.js
提交
3910b6de
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,发现更多精彩内容 >>
提交
3910b6de
编写于
7月 09, 2019
作者:
Y
Yuki Takemoto
提交者:
Joe Haddad
7月 08, 2019
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Upgrade next of with-typescript-styled-components sample (#7788)
上级
7da546a3
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
35 addition
and
20 deletion
+35
-20
examples/with-typescript-styled-components/.babelrc
examples/with-typescript-styled-components/.babelrc
+1
-1
examples/with-typescript-styled-components/next-env.d.ts
examples/with-typescript-styled-components/next-env.d.ts
+2
-0
examples/with-typescript-styled-components/next.config.js
examples/with-typescript-styled-components/next.config.js
+0
-2
examples/with-typescript-styled-components/package.json
examples/with-typescript-styled-components/package.json
+10
-9
examples/with-typescript-styled-components/pages/_document.tsx
...les/with-typescript-styled-components/pages/_document.tsx
+5
-5
examples/with-typescript-styled-components/tsconfig.json
examples/with-typescript-styled-components/tsconfig.json
+17
-3
未找到文件。
examples/with-typescript-styled-components/.babelrc
浏览文件 @
3910b6de
{
"presets": ["next/babel"
, "@zeit/next-typescript/babel"
],
"presets": ["next/babel"],
"plugins": [["styled-components", { "ssr": true }]]
}
examples/with-typescript-styled-components/next-env.d.ts
0 → 100644
浏览文件 @
3910b6de
/// <reference types="next" />
/// <reference types="next/types/global" />
examples/with-typescript-styled-components/next.config.js
已删除
100644 → 0
浏览文件 @
7da546a3
const
withTypescript
=
require
(
'
@zeit/next-typescript
'
)
module
.
exports
=
withTypescript
()
examples/with-typescript-styled-components/package.json
浏览文件 @
3910b6de
...
...
@@ -7,17 +7,18 @@
"start"
:
"next start"
},
"dependencies"
:
{
"@types/next"
:
"^8.0.1"
,
"@types/react"
:
"^16.8.6"
,
"@types/styled-components"
:
"^4.1.11"
,
"@zeit/next-typescript"
:
"^1.1.1"
,
"next"
:
"^8.0.3"
,
"react"
:
"^16.8.3"
,
"react-dom"
:
"^16.8.3"
,
"next"
:
"9.0.0"
,
"react"
:
"16.8.6"
,
"react-dom"
:
"16.8.6"
,
"styled-components"
:
"^4.1.3"
},
"devDependencies"
:
{
"babel-plugin-styled-components"
:
"^1.10.0"
"@types/node"
:
"12.0.12"
,
"@types/react"
:
"16.8.23"
,
"@types/react-dom"
:
"16.8.4"
,
"@types/styled-components"
:
"4.1.16"
,
"babel-plugin-styled-components"
:
"^1.10.0"
,
"typescript"
:
"3.5.2"
},
"license"
:
"ISC"
}
}
\ No newline at end of file
examples/with-typescript-styled-components/pages/_document.tsx
浏览文件 @
3910b6de
import
Document
,
{
Next
DocumentContext
}
from
'
next/document
'
import
Document
,
{
DocumentContext
}
from
'
next/document
'
import
{
ServerStyleSheet
}
from
'
styled-components
'
export
default
class
MyDocument
extends
Document
{
static
async
getInitialProps
(
ctx
:
Next
DocumentContext
)
{
static
async
getInitialProps
(
ctx
:
DocumentContext
)
{
const
sheet
=
new
ServerStyleSheet
()
const
originalRenderPage
=
ctx
.
renderPage
...
...
@@ -15,12 +15,12 @@ export default class MyDocument extends Document {
const
initialProps
=
await
Document
.
getInitialProps
(
ctx
)
return
{
...
initialProps
,
styles
:
(
styles
:
[
<>
{
initialProps
.
styles
}
{
sheet
.
getStyleElement
()
}
</>
)
,
</>
,
]
,
}
}
finally
{
sheet
.
seal
()
...
...
examples/with-typescript-styled-components/tsconfig.json
浏览文件 @
3910b6de
...
...
@@ -3,7 +3,10 @@
"target"
:
"esnext"
,
"module"
:
"esnext"
,
"jsx"
:
"preserve"
,
"lib"
:
[
"dom"
,
"es2017"
],
"lib"
:
[
"dom"
,
"es2017"
],
"moduleResolution"
:
"node"
,
"allowJs"
:
true
,
"noEmit"
:
true
,
...
...
@@ -15,6 +18,17 @@
"removeComments"
:
false
,
"preserveConstEnums"
:
true
,
"sourceMap"
:
true
,
"esModuleInterop"
:
true
}
"esModuleInterop"
:
true
,
"forceConsistentCasingInFileNames"
:
true
,
"resolveJsonModule"
:
true
,
"isolatedModules"
:
true
},
"exclude"
:
[
"node_modules"
],
"include"
:
[
"next-env.d.ts"
,
"**/*.ts"
,
"**/*.tsx"
]
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录