Skip to content
This repository was archived by the owner on Nov 8, 2022. It is now read-only.

Commit 983e5a5

Browse files
authored
chore(deps): upgrade next 12 (#1265)
* chore(deps): upgrade next.12 latest swc * chore(deps): rm useless babel pkgs * chore: wip * chore: add babel back for prod, displayName issue * chore(swc): styledComponents for dev mode
1 parent d79e648 commit 983e5a5

File tree

8 files changed

+931
-3252
lines changed

8 files changed

+931
-3252
lines changed

.babelrc

100755100644
File mode changed.

.gitignore

+5-1
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,8 @@ cypress//integration/examples
1414
.eslintcache
1515

1616
cypress/videos/*
17-
tsconfig.tsbuildinfo
17+
tsconfig.tsbuildinfopublic/sw.js
18+
public/sw.js
19+
public/sw.js.map
20+
public/workbox-*
21+
tsconfig.tsbuildinfo

next-env.d.ts

-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
/// <reference types="next" />
2-
/// <reference types="next/types/global" />
32
/// <reference types="next/image-types/global" />
43

54
// NOTE: This file should not be edited

next.config.js

+8
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ const withBundleAnalyzer = require('@next/bundle-analyzer')({
1313

1414
// if move pwa config to witPlugins, it will not work
1515
const nextConfig = withPWA({
16+
// swcMinify: true,
1617
productionBrowserSourceMaps: false,
1718
pwa: {
1819
dest: 'public',
@@ -21,6 +22,13 @@ const nextConfig = withPWA({
2122
// scope: '/cp',
2223
sw: 'sw.js',
2324
},
25+
compiler: {
26+
// ssr and displayName are configured by default
27+
styledComponents: true,
28+
},
29+
// experimental: {
30+
// outputStandalone: true,
31+
// },
2432
})
2533

2634
module.exports = withPlugins([withBundleAnalyzer, withSourceMaps], nextConfig)

package-lock.json

+877-3,226
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+4-7
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,6 @@
4040
}
4141
},
4242
"dependencies": {
43-
"@babel/core": "^7.13.14",
4443
"@groupher/react-editor": "^1.1.30",
4544
"@next-boost/hybrid-disk-cache": "^0.3.0",
4645
"@next-boost/next-boost": "^0.15.1",
@@ -54,7 +53,7 @@
5453
"accepts": "^1.3.4",
5554
"ali-oss": "^5.3.2",
5655
"babel-plugin-add-react-displayname": "^0.0.5",
57-
"babel-plugin-styled-components": "^1.12.0",
56+
"babel-plugin-styled-components": "^2.0.3",
5857
"cacheable-response": "^2.0.9",
5958
"chalk": "^2.4.1",
6059
"compatible-debug": "^1.0.0",
@@ -77,7 +76,7 @@
7776
"mobx-state-tree": "5.0.2",
7877
"module-alias": "^2.0.1",
7978
"nanoid": "^3.1.12",
80-
"next": "^12.0.1",
79+
"next": "^12.1.0",
8180
"next-compose-plugins": "^2.2.0",
8281
"next-i18next": "4.4.1",
8382
"next-offline": "4.0.6",
@@ -92,13 +91,13 @@
9291
"pubsub-js": "^1.9.3",
9392
"qrcode.react": "^1.0.1",
9493
"ramda": "0.26.1",
95-
"react": "17.0.2",
94+
"react": "^17.0.2",
9695
"react-animation": "^1.2.2",
9796
"react-calendar-heatmap": "1.8.1",
9897
"react-content-loader": "3.4.2",
9998
"react-copy-to-clipboard": "^5.0.3",
10099
"react-device-detect": "^2.1.2",
101-
"react-dom": "17.0.2",
100+
"react-dom": "^17.0.2",
102101
"react-highlight-words": "^0.16.0",
103102
"react-lazy-load-image-component": "1.5.0",
104103
"react-masonry-component": "^6.0.1",
@@ -143,8 +142,6 @@
143142
"@types/styled-components": "^5.1.8",
144143
"@typescript-eslint/eslint-plugin": "^4.17.0",
145144
"@typescript-eslint/parser": "^4.17.0",
146-
"babel-eslint": "^10.0.2",
147-
"babel-jest": "^23.6.0",
148145
"bundlewatch": "^0.2.7",
149146
"commitizen": "3.1.2",
150147
"coveralls": "3.0.14",

src/containers/tool/Drawer/dynamics.tsx

+30-12
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
import dynamic from 'next/dynamic'
33

44
import { LavaLampLoading } from '@/widgets/dynamic'
5-
import EditorLoading from '@/widgets/Loading/EditorLoading'
5+
// import EditorLoading from '@/widgets/Loading/EditorLoading'
66

77
import { LavaLoadingWrapper } from './styles'
88

@@ -21,38 +21,53 @@ const commonConfig = {
2121
}
2222

2323
// editor style loading config
24-
const editorConfig = {
25-
// @ts-ignore
26-
loading: () => <EditorLoading />,
27-
ssr: false,
28-
}
24+
// const editorConfig = {
25+
// // @ts-ignore
26+
// loading: () => <EditorLoading />,
27+
// ssr: false,
28+
// }
2929

3030
// viewers
3131
export const ArticleViewer = dynamic(
3232
() => import('@/containers/viewer/ArticleViewer'),
33-
commonConfig,
33+
{
34+
loading: () => <CommonLoading />,
35+
ssr: false,
36+
},
3437
)
3538

3639
export const MailsViewer = dynamic(
3740
() => import('@/containers/viewer/MailsViewer'),
38-
commonConfig,
41+
{
42+
loading: () => <CommonLoading />,
43+
ssr: false,
44+
},
3945
)
4046

4147
export const RepoViewer = dynamic(
4248
() => import('@/containers/viewer/RepoViewer'),
43-
commonConfig,
49+
{
50+
loading: () => <CommonLoading />,
51+
ssr: false,
52+
},
4453
)
4554

4655
// editors
4756
export const AccountEditor = dynamic(
4857
() => import('@/containers/editor/AccountEditor'),
49-
commonConfig,
58+
{
59+
loading: () => <CommonLoading />,
60+
ssr: false,
61+
},
5062
)
5163

5264
// user lister
5365
export const UserLister = dynamic(
5466
() => import('@/containers/user/UserLister'),
55-
commonConfig,
67+
{
68+
loading: () => <CommonLoading />,
69+
ssr: false,
70+
},
5671
)
5772

5873
// export const RepoEditor = dynamic(
@@ -63,5 +78,8 @@ export const UserLister = dynamic(
6378
// utils
6479
export const C11NSettingPanel = dynamic(
6580
() => import('@/containers/tool/C11NSettingPanel'),
66-
commonConfig,
81+
{
82+
loading: () => <CommonLoading />,
83+
ssr: false,
84+
},
6785
)

src/widgets/PostItem/DesktopView/index.tsx

+7-5
Original file line numberDiff line numberDiff line change
@@ -31,11 +31,13 @@ const DigestView: FC<TProps> = ({ curCommunity, entry }) => {
3131
// 尤其是在 Tab 切换的时候。手机端因为目前没有这些组件,性能暂无问题。
3232
// 本不应该存在的无聊问题,蛋疼的解决办法,
3333
useEffect(() => {
34-
const cfg = { ssr: false }
35-
36-
Upvote = dynamic(() => import('@/widgets/Upvote'), cfg)
37-
ArticleReadLabel = dynamic(() => import('@/widgets/ArticleReadLabel'), cfg)
38-
ArticlePinLabel = dynamic(() => import('@/widgets/ArticlePinLabel'), cfg)
34+
Upvote = dynamic(() => import('@/widgets/Upvote'), { ssr: false })
35+
ArticleReadLabel = dynamic(() => import('@/widgets/ArticleReadLabel'), {
36+
ssr: false,
37+
})
38+
ArticlePinLabel = dynamic(() => import('@/widgets/ArticlePinLabel'), {
39+
ssr: false,
40+
})
3941

4042
setTimeout(() => {
4143
setLoaded(true)

0 commit comments

Comments
 (0)