-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[REFACTOR] 홈 화면 성능 개선 #285
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
코드 잘 읽어봤어요~~
궁금한 것들 질문 남겼으니 천천히 답변 달아주세요
frontend/package.json
Outdated
"start": "webpack serve --config webpack.config.dev.js", | ||
"dev": "webpack serve --config webpack.config.dev.js", | ||
"start": "webpack serve --config webpack.config.prod.js", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🙏 제안 🙏
이름을 dev/prod 환경에 대응되도록 start에서 prod로 바꾸는 건 어떠한가요?
frontend/src/router/lazyPages.ts
Outdated
export const GamePage = lazy(() => import('@/pages/GamePage/GamePage')); | ||
export const GameResultPage = lazy(() => import('@/pages/GameResultPage/GameResultPage')); | ||
export const MainPage = lazy(() => import('@/pages/MainPage/MainPage')); | ||
export const NicknamePage = lazy(() => import('@/pages/NicknamePage/NicknamePage')); | ||
export const ReadyPage = lazy(() => import('@/pages/ReadyPage/ReadyPage')); | ||
export const RoundResultPage = lazy(() => import('@/pages/RoundResultPage/RoundResultPage')); | ||
export const VoteStatusPage = lazy(() => import('@/pages/VoteStatusPage/VoteStatusPage')); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🌸 칭찬 🌸
lazy loading 좋네요 굿굿
@@ -30,7 +30,7 @@ module.exports = { | |||
], | |||
}, | |||
{ | |||
test: /\.(png|jpe?g|gif|svg)$/i, | |||
test: /\.(png|jpe?g|gif|svg|webp)$/i, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🌸 칭찬 🌸
webp 포함 굿굿
template: path.join(__dirname, './public/index.html'), | ||
hash: true, | ||
favicon: path.join(__dirname, './public/favicon.ico'), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🌸 칭찬 🌸
favicon이 없었는데 추가되었군요 굿굿
<link | ||
href="https://cdn.jsdelivr.net/gh/orioncactus/[email protected]/packages/pretendard/dist/web/static/woff2-dynamic-subset/Pretendard-Regular.subset.91.woff2" | ||
rel="preload" as="font" type="font/woff2" crossorigin /> | ||
<link | ||
href="https://cdn.jsdelivr.net/gh/orioncactus/[email protected]/packages/pretendard/dist/web/static/woff2-dynamic-subset/Pretendard-Bold.subset.83.woff2" | ||
rel="preload" as="font" type="font/woff2" crossorigin /> | ||
<link | ||
href="https://cdn.jsdelivr.net/gh/orioncactus/[email protected]/packages/pretendard/dist/web/static/woff2-dynamic-subset/Pretendard-Bold.subset.84.woff2" | ||
rel="preload" as="font" type="font/woff2" crossorigin /> | ||
<link | ||
href="https://cdn.jsdelivr.net/gh/orioncactus/[email protected]/packages/pretendard/dist/web/static/woff2-dynamic-subset/Pretendard-Bold.subset.85.woff2" | ||
rel="preload" as="font" type="font/woff2" crossorigin /> | ||
<link | ||
href="https://cdn.jsdelivr.net/gh/orioncactus/[email protected]/packages/pretendard/dist/web/static/woff2-dynamic-subset/Pretendard-Bold.subset.89.woff2" | ||
rel="preload" as="font" type="font/woff2" crossorigin /> | ||
<link | ||
href="https://cdn.jsdelivr.net/gh/orioncactus/[email protected]/packages/pretendard/dist/web/static/woff2-dynamic-subset/Pretendard-Bold.subset.90.woff2" | ||
rel="preload" as="font" type="font/woff2" crossorigin /> | ||
<link | ||
href="https://cdn.jsdelivr.net/gh/orioncactus/[email protected]/packages/pretendard/dist/web/static/woff2-dynamic-subset/Pretendard-Bold.subset.91.woff2" | ||
rel="preload" as="font" type="font/woff2" crossorigin /> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💭 질문 💭
이미 위쪽에 폰트 link가 있는 상태인데 서로 다른 폰트를 가져오는 태그인가요?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
서브셋 폰트를 사용하면 용량을 크게 줄일 수 있더라구요! PR 본문에도 작성했는데 기존에 가져오던 방식대로라면 폰트 용량이 2.1MB로 엄청 큽니다. 근데 그 상태에서 preload를 진행하면 흰 화면을 오래 보게 되더라고요
그래서 폰트 용량을 줄여야하는데, 그 방법 중 하나로 서브셋 폰트가 있습니다. 서브셋 폰트를 적용한 후 실행하면 홈화면에 필요한 서브셋 폰트가 네트워크탭에 나타났었는데, 해당 폰트만 preload한 거라고 보시면 됩니당
Issue Number
As-Is
To-Be
Check List
Test Screenshot
번들 사이즈 줄이기
개선 전 lighthouse / bundle
개선 후 lighthouse / bundle
폰트 preload
DOMContentLoad
: 브라우저가 HTML을 전부 읽고 DOM 트리를 완성하는 즉시 발생 (외부 리소스 x)load
: DOMContentLoad + 이미지, 스타일시트 같은 외부 리소스도 모두 불러오는 것이 끝났을 때 발생초기 상태 : 번들을 모두 다운받은 후 폰트 load
이미지 최적화
93.8KB -> 16.9KB
(Optional) Additional Description
로컬 폰트
로 하면 사용자 컴퓨터에 깔려있는 경우 네트워크탭도 안거쳐서 로컬 폰트로 바꿀까 고민중🌸 Storybook 배포 주소