mirror of
https://github.com/d0zingcat/NotionNext.git
synced 2026-06-05 23:16:52 +00:00
Merge pull request #1931 from tangly1024/feat-optimization-size
异步加载AlgoliaModal
This commit is contained in:
@@ -18,7 +18,7 @@
|
|||||||
"start": "next start",
|
"start": "next start",
|
||||||
"post-build": "next-sitemap --config next-sitemap.config.js",
|
"post-build": "next-sitemap --config next-sitemap.config.js",
|
||||||
"export": "next build && next-sitemap --config next-sitemap.config.js && next export",
|
"export": "next build && next-sitemap --config next-sitemap.config.js && next export",
|
||||||
"bundle-report": "ANALYZE=true yarn build"
|
"bundle-report": "cross-env ANALYZE=true yarn build"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@giscus/react": "^2.2.6",
|
"@giscus/react": "^2.2.6",
|
||||||
@@ -27,7 +27,7 @@
|
|||||||
"@vercel/analytics": "^1.0.0",
|
"@vercel/analytics": "^1.0.0",
|
||||||
"algoliasearch": "^4.18.0",
|
"algoliasearch": "^4.18.0",
|
||||||
"animejs": "^3.2.1",
|
"animejs": "^3.2.1",
|
||||||
"aos": "^3.0.0-beta.6",
|
"aos": "^2.3.4",
|
||||||
"axios": ">=0.21.1",
|
"axios": ">=0.21.1",
|
||||||
"copy-to-clipboard": "^3.3.1",
|
"copy-to-clipboard": "^3.3.1",
|
||||||
"feed": "^4.2.2",
|
"feed": "^4.2.2",
|
||||||
@@ -53,6 +53,7 @@
|
|||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@waline/client": "^2.5.1",
|
"@waline/client": "^2.5.1",
|
||||||
"autoprefixer": "^10.4.13",
|
"autoprefixer": "^10.4.13",
|
||||||
|
"cross-env": "^7.0.3",
|
||||||
"eslint": "^7.26.0",
|
"eslint": "^7.26.0",
|
||||||
"eslint-config-next": "^13.1.1",
|
"eslint-config-next": "^13.1.1",
|
||||||
"eslint-config-standard": "^16.0.2",
|
"eslint-config-standard": "^16.0.2",
|
||||||
|
|||||||
@@ -54,9 +54,9 @@ const BlogListPage = ({ page = 1, posts = [], postCount, siteInfo }) => {
|
|||||||
<div>
|
<div>
|
||||||
{/* 文章列表 */}
|
{/* 文章列表 */}
|
||||||
<div id="posts-wrapper" className='grid-container'>
|
<div id="posts-wrapper" className='grid-container'>
|
||||||
{filterPosts?.map(post => (
|
{filterPosts?.map((post, index) => (
|
||||||
<div key={post.id} className='grid-item justify-center flex' style={{ breakInside: 'avoid' }}>
|
<div key={post.id} className='grid-item justify-center flex' style={{ breakInside: 'avoid' }}>
|
||||||
<BlogCard index={posts.indexOf(post)} key={post.id} post={post} siteInfo={siteInfo} />
|
<BlogCard index={index} key={post.id} post={post} siteInfo={siteInfo} />
|
||||||
</div>
|
</div>
|
||||||
))}
|
))}
|
||||||
{siteConfig('ADSENSE_GOOGLE_ID') && (
|
{siteConfig('ADSENSE_GOOGLE_ID') && (
|
||||||
|
|||||||
@@ -34,7 +34,8 @@ import Link from 'next/link'
|
|||||||
import dynamic from 'next/dynamic'
|
import dynamic from 'next/dynamic'
|
||||||
import { siteConfig } from '@/lib/config'
|
import { siteConfig } from '@/lib/config'
|
||||||
import NotionIcon from '@/components/NotionIcon'
|
import NotionIcon from '@/components/NotionIcon'
|
||||||
import AlgoliaSearchModal from '@/components/AlgoliaSearchModal'
|
|
||||||
|
const AlgoliaSearchModal = dynamic(() => import('@/components/AlgoliaSearchModal'), { ssr: false })
|
||||||
const WWAds = dynamic(() => import('@/components/WWAds'), { ssr: false })
|
const WWAds = dynamic(() => import('@/components/WWAds'), { ssr: false })
|
||||||
|
|
||||||
// 主题全局变量
|
// 主题全局变量
|
||||||
|
|||||||
@@ -1,9 +1,11 @@
|
|||||||
import { siteConfig } from '@/lib/config'
|
import { siteConfig } from '@/lib/config'
|
||||||
import { useGlobal } from '@/lib/global'
|
import { useGlobal } from '@/lib/global'
|
||||||
|
import dynamic from 'next/dynamic'
|
||||||
import { useRouter } from 'next/router'
|
import { useRouter } from 'next/router'
|
||||||
import AlgoliaSearchModal from '@/components/AlgoliaSearchModal'
|
|
||||||
import { useRef } from 'react'
|
import { useRef } from 'react'
|
||||||
|
|
||||||
|
const AlgoliaSearchModal = dynamic(() => import('@/components/AlgoliaSearchModal'), { ssr: false })
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 搜索按钮
|
* 搜索按钮
|
||||||
* @returns
|
* @returns
|
||||||
|
|||||||
@@ -31,7 +31,9 @@ import { Transition } from '@headlessui/react'
|
|||||||
import { Style } from './style'
|
import { Style } from './style'
|
||||||
import replaceSearchResult from '@/components/Mark'
|
import replaceSearchResult from '@/components/Mark'
|
||||||
import { siteConfig } from '@/lib/config'
|
import { siteConfig } from '@/lib/config'
|
||||||
import AlgoliaSearchModal from '@/components/AlgoliaSearchModal'
|
import dynamic from 'next/dynamic'
|
||||||
|
|
||||||
|
const AlgoliaSearchModal = dynamic(() => import('@/components/AlgoliaSearchModal'), { ssr: false })
|
||||||
|
|
||||||
// 主题全局状态
|
// 主题全局状态
|
||||||
const ThemeGlobalHexo = createContext()
|
const ThemeGlobalHexo = createContext()
|
||||||
|
|||||||
@@ -24,9 +24,11 @@ import BlogListBar from './components/BlogListBar'
|
|||||||
import { Style } from './style'
|
import { Style } from './style'
|
||||||
import replaceSearchResult from '@/components/Mark'
|
import replaceSearchResult from '@/components/Mark'
|
||||||
import { siteConfig } from '@/lib/config'
|
import { siteConfig } from '@/lib/config'
|
||||||
import AlgoliaSearchModal from '@/components/AlgoliaSearchModal'
|
|
||||||
import Announcement from './components/Announcement'
|
import Announcement from './components/Announcement'
|
||||||
import Card from './components/Card'
|
import Card from './components/Card'
|
||||||
|
import dynamic from 'next/dynamic'
|
||||||
|
|
||||||
|
const AlgoliaSearchModal = dynamic(() => import('@/components/AlgoliaSearchModal'), { ssr: false })
|
||||||
|
|
||||||
// 主题全局状态
|
// 主题全局状态
|
||||||
const ThemeGlobalNext = createContext()
|
const ThemeGlobalNext = createContext()
|
||||||
|
|||||||
@@ -22,9 +22,11 @@ import BlogListBar from './components/BlogListBar'
|
|||||||
import { Transition } from '@headlessui/react'
|
import { Transition } from '@headlessui/react'
|
||||||
import { Style } from './style'
|
import { Style } from './style'
|
||||||
import replaceSearchResult from '@/components/Mark'
|
import replaceSearchResult from '@/components/Mark'
|
||||||
import AlgoliaSearchModal from '@/components/AlgoliaSearchModal'
|
|
||||||
import { siteConfig } from '@/lib/config'
|
import { siteConfig } from '@/lib/config'
|
||||||
import { useRouter } from 'next/router'
|
import { useRouter } from 'next/router'
|
||||||
|
import dynamic from 'next/dynamic'
|
||||||
|
|
||||||
|
const AlgoliaSearchModal = dynamic(() => import('@/components/AlgoliaSearchModal'), { ssr: false })
|
||||||
|
|
||||||
// 主题全局状态
|
// 主题全局状态
|
||||||
const ThemeGlobalNobelium = createContext()
|
const ThemeGlobalNobelium = createContext()
|
||||||
|
|||||||
@@ -10,9 +10,10 @@ import { Style } from './style'
|
|||||||
import replaceSearchResult from '@/components/Mark'
|
import replaceSearchResult from '@/components/Mark'
|
||||||
import dynamic from 'next/dynamic'
|
import dynamic from 'next/dynamic'
|
||||||
import NotionPage from '@/components/NotionPage'
|
import NotionPage from '@/components/NotionPage'
|
||||||
import AlgoliaSearchModal from '@/components/AlgoliaSearchModal'
|
|
||||||
import { useRouter } from 'next/router'
|
import { useRouter } from 'next/router'
|
||||||
|
|
||||||
|
const AlgoliaSearchModal = dynamic(() => import('@/components/AlgoliaSearchModal'), { ssr: false })
|
||||||
|
|
||||||
// 主题组件
|
// 主题组件
|
||||||
const BlogListScroll = dynamic(() => import('./components/BlogListScroll'), { ssr: false });
|
const BlogListScroll = dynamic(() => import('./components/BlogListScroll'), { ssr: false });
|
||||||
const BlogArchiveItem = dynamic(() => import('./components/BlogArchiveItem'), { ssr: false });
|
const BlogArchiveItem = dynamic(() => import('./components/BlogArchiveItem'), { ssr: false });
|
||||||
|
|||||||
33
yarn.lock
33
yarn.lock
@@ -1655,14 +1655,14 @@ anymatch@~3.1.2:
|
|||||||
normalize-path "^3.0.0"
|
normalize-path "^3.0.0"
|
||||||
picomatch "^2.0.4"
|
picomatch "^2.0.4"
|
||||||
|
|
||||||
aos@^3.0.0-beta.6:
|
aos@^2.3.4:
|
||||||
version "3.0.0-beta.6"
|
version "2.3.4"
|
||||||
resolved "https://registry.yarnpkg.com/aos/-/aos-3.0.0-beta.6.tgz#75148e3be4bb1add53f5a1828623bf82b67691e9"
|
resolved "https://r2.cnpmjs.org/aos/-/aos-2.3.4.tgz#eb1c29f5c1806a197cf6323080747547edd3db8e"
|
||||||
integrity sha512-VLWrpq8bfAWcetynVHMMrqdC+89Qq/Ym6UBJbHB4crIwp3RR8uq1dNGgsFzoDl03S43rlVMK+na3r5+oUCZsYw==
|
integrity sha512-zh/ahtR2yME4I51z8IttIt4lC1Nw0ktsFtmeDzID1m9naJnWXhCoARaCgNOGXb5CLy3zm+wqmRAEgMYB5E2HUw==
|
||||||
dependencies:
|
dependencies:
|
||||||
classlist-polyfill "^1.2.0"
|
classlist-polyfill "^1.0.3"
|
||||||
lodash.debounce "^4.0.8"
|
lodash.debounce "^4.0.6"
|
||||||
lodash.throttle "^4.1.1"
|
lodash.throttle "^4.0.1"
|
||||||
|
|
||||||
arg@^5.0.2:
|
arg@^5.0.2:
|
||||||
version "5.0.2"
|
version "5.0.2"
|
||||||
@@ -1985,9 +1985,9 @@ chokidar@^3.5.3:
|
|||||||
optionalDependencies:
|
optionalDependencies:
|
||||||
fsevents "~2.3.2"
|
fsevents "~2.3.2"
|
||||||
|
|
||||||
classlist-polyfill@^1.2.0:
|
classlist-polyfill@^1.0.3:
|
||||||
version "1.2.0"
|
version "1.2.0"
|
||||||
resolved "https://registry.yarnpkg.com/classlist-polyfill/-/classlist-polyfill-1.2.0.tgz#935bc2dfd9458a876b279617514638bcaa964a2e"
|
resolved "https://r2.cnpmjs.org/classlist-polyfill/-/classlist-polyfill-1.2.0.tgz#935bc2dfd9458a876b279617514638bcaa964a2e"
|
||||||
integrity sha512-GzIjNdcEtH4ieA2S8NmrSxv7DfEV5fmixQeyTmqmRmRJPGpRBaSnA2a0VrCjyT8iW8JjEdMbKzDotAJf+ajgaQ==
|
integrity sha512-GzIjNdcEtH4ieA2S8NmrSxv7DfEV5fmixQeyTmqmRmRJPGpRBaSnA2a0VrCjyT8iW8JjEdMbKzDotAJf+ajgaQ==
|
||||||
|
|
||||||
classnames@^2.3.2:
|
classnames@^2.3.2:
|
||||||
@@ -2077,7 +2077,14 @@ copy-to-clipboard@^3.3.1:
|
|||||||
dependencies:
|
dependencies:
|
||||||
toggle-selection "^1.0.6"
|
toggle-selection "^1.0.6"
|
||||||
|
|
||||||
cross-spawn@^7.0.0, cross-spawn@^7.0.2:
|
cross-env@^7.0.3:
|
||||||
|
version "7.0.3"
|
||||||
|
resolved "https://r2.cnpmjs.org/cross-env/-/cross-env-7.0.3.tgz#865264b29677dc015ba8418918965dd232fc54cf"
|
||||||
|
integrity sha512-+/HKd6EgcQCJGh2PSjZuUitQBQynKor4wrFbRg4DtAgS1aWO+gU52xpH7M9ScGgXSYmAVS9bIJ8EzuaGw0oNAw==
|
||||||
|
dependencies:
|
||||||
|
cross-spawn "^7.0.1"
|
||||||
|
|
||||||
|
cross-spawn@^7.0.0, cross-spawn@^7.0.1, cross-spawn@^7.0.2:
|
||||||
version "7.0.3"
|
version "7.0.3"
|
||||||
resolved "https://registry.yarnpkg.com/cross-spawn/-/cross-spawn-7.0.3.tgz#f73a85b9d5d41d045551c177e2882d4ac85728a6"
|
resolved "https://registry.yarnpkg.com/cross-spawn/-/cross-spawn-7.0.3.tgz#f73a85b9d5d41d045551c177e2882d4ac85728a6"
|
||||||
integrity sha512-iRDPJKUPVEND7dHPO8rkbOnPpyDygcDFtWjpeWNCgy8WP2rXcxXL8TskReQl6OrB2G7+UJrags1q15Fudc7G6w==
|
integrity sha512-iRDPJKUPVEND7dHPO8rkbOnPpyDygcDFtWjpeWNCgy8WP2rXcxXL8TskReQl6OrB2G7+UJrags1q15Fudc7G6w==
|
||||||
@@ -3515,9 +3522,9 @@ localStorage@^1.0.4:
|
|||||||
resolved "https://registry.yarnpkg.com/localStorage/-/localStorage-1.0.4.tgz#57dfa28084385f81431accb8ae24b196398223f7"
|
resolved "https://registry.yarnpkg.com/localStorage/-/localStorage-1.0.4.tgz#57dfa28084385f81431accb8ae24b196398223f7"
|
||||||
integrity sha512-r35zrihcDiX+dqWlJSeIwS9nrF95OQTgqMFm3FB2D/+XgdmZtcutZOb7t0xXkhOEM8a9kpuu7cc28g1g36I5DQ==
|
integrity sha512-r35zrihcDiX+dqWlJSeIwS9nrF95OQTgqMFm3FB2D/+XgdmZtcutZOb7t0xXkhOEM8a9kpuu7cc28g1g36I5DQ==
|
||||||
|
|
||||||
lodash.debounce@^4.0.8:
|
lodash.debounce@^4.0.6:
|
||||||
version "4.0.8"
|
version "4.0.8"
|
||||||
resolved "https://registry.yarnpkg.com/lodash.debounce/-/lodash.debounce-4.0.8.tgz#82d79bff30a67c4005ffd5e2515300ad9ca4d7af"
|
resolved "https://r2.cnpmjs.org/lodash.debounce/-/lodash.debounce-4.0.8.tgz#82d79bff30a67c4005ffd5e2515300ad9ca4d7af"
|
||||||
integrity sha512-FT1yDzDYEoYWhnSGnpE/4Kj1fLZkDFyqRb7fNt6FdYOSxlUWAtp42Eh6Wb0rGIv/m9Bgo7x4GhQbm5Ys4SG5ow==
|
integrity sha512-FT1yDzDYEoYWhnSGnpE/4Kj1fLZkDFyqRb7fNt6FdYOSxlUWAtp42Eh6Wb0rGIv/m9Bgo7x4GhQbm5Ys4SG5ow==
|
||||||
|
|
||||||
lodash.merge@^4.6.2:
|
lodash.merge@^4.6.2:
|
||||||
@@ -3525,7 +3532,7 @@ lodash.merge@^4.6.2:
|
|||||||
resolved "https://registry.yarnpkg.com/lodash.merge/-/lodash.merge-4.6.2.tgz#558aa53b43b661e1925a0afdfa36a9a1085fe57a"
|
resolved "https://registry.yarnpkg.com/lodash.merge/-/lodash.merge-4.6.2.tgz#558aa53b43b661e1925a0afdfa36a9a1085fe57a"
|
||||||
integrity sha512-0KpjqXRVvrYyCsX1swR/XTK0va6VQkQM6MNo7PqW77ByjAhoARA8EfrP1N4+KlKj8YS0ZUCtRT/YUuhyYDujIQ==
|
integrity sha512-0KpjqXRVvrYyCsX1swR/XTK0va6VQkQM6MNo7PqW77ByjAhoARA8EfrP1N4+KlKj8YS0ZUCtRT/YUuhyYDujIQ==
|
||||||
|
|
||||||
lodash.throttle@^4.1.1:
|
lodash.throttle@^4.0.1, lodash.throttle@^4.1.1:
|
||||||
version "4.1.1"
|
version "4.1.1"
|
||||||
resolved "https://registry.yarnpkg.com/lodash.throttle/-/lodash.throttle-4.1.1.tgz#c23e91b710242ac70c37f1e1cda9274cc39bf2f4"
|
resolved "https://registry.yarnpkg.com/lodash.throttle/-/lodash.throttle-4.1.1.tgz#c23e91b710242ac70c37f1e1cda9274cc39bf2f4"
|
||||||
integrity sha512-wIkUCfVKpVsWo3JSZlc+8MB5it+2AN5W8J7YVMST30UrvcQNZ1Okbj+rbVniijTWE6FGYy4XJq/rHkas8qJMLQ==
|
integrity sha512-wIkUCfVKpVsWo3JSZlc+8MB5it+2AN5W8J7YVMST30UrvcQNZ1Okbj+rbVniijTWE6FGYy4XJq/rHkas8qJMLQ==
|
||||||
|
|||||||
Reference in New Issue
Block a user