-
Notifications
You must be signed in to change notification settings - Fork 125
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
[개인 미션 - 성능 오답노트] 루루(송지은) 미션 제출합니다. #77
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.
루루의 리뷰를 맞게 되어 영광입니다👍👍
몇 가지 궁금한 점에 대해 간단하게 리뷰 남겨봤습니다! 확인 부탁드릴게요~~
<div id="app"></div> | ||
</body> | ||
</html> | ||
<head> |
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.
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.
a83d512
적용했습니당!
"@babel/preset-react" | ||
"@babel/preset-react", | ||
{ | ||
"modules": false |
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.
오 이 부분은 어떤걸 의미하는 건가요??
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.
"modules": false을 한 이유는 balel이 commonJS로 변환하기도 하는데 그러면 sideEffects옵션이 작동하지 않는다고해서 넣어준 설정입니다
|
||
import NavBar from './components/NavBar/NavBar'; | ||
import Footer from './components/Footer/Footer'; | ||
|
||
import './App.css'; | ||
|
||
const Home = lazy(() => import('./pages/Home/Home')); |
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.
다른 크루분들 중에 Home
컴포넌트는 초기 렌더링에 사용되는 컴포넌트라서 동적 import를 사용하지 않은 분들도 계시는데 루루는 분리 해주셨군요! 혹시 Home
컴포넌트도 동적 import를 적용해준 이유가 있나요?!
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.
만약 /searsh
로 바로 접속하게 된다면 Home
파일도 불러오게 되니까 적용했습니다!
src/assets/images/hero.png
Outdated
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.
hero 이미지의 크기를 1025 * 684로 해주신 이유가 있나요?! 전 크기를 어떻게 해야할지 몰라서 일반적인 모니터 기준인 1920 * 1080으로 해줬었는데 사이즈를 더 줄일 수 있으면 좋을 것 같아서요!
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.
어,, 그냥 변환사이트에서 파일용량이 제 마음에 맞게 작아지는 사이즈로 해둔거였어요! 파일 퀄리티도 용량이 줄어들지만 이미지 크기를 줄이면 꽤나 크게 용량이 줄어들더라구요. 큰 이유는 없습니다.ㅋㅋ
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.
아하 ㅋㅋㅋㅋ 전 뭔가 지정된 크기가 있었나 해서 여쭤봤었는데 그런게 따로 있지는 않았나보군요!
@@ -19,7 +26,14 @@ const Home = () => { | |||
return ( | |||
<> | |||
<section className={styles.heroSection}> | |||
<img className={styles.heroImage} src={heroImage} alt="hero image" /> | |||
<picture> |
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.
picture 태그는 어떤 역할을 수행하나요?! 전 한번도 사용해보지 않은 태그여서 궁금합니다!😀
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를 지원할 경우와 안할경우로 나눠서 정의했기 때문에 사용했어요
@@ -16,4 +16,4 @@ const GifItem = ({ imageUrl = '', title = '' }: GifItemProps) => { | |||
); | |||
}; | |||
|
|||
export default GifItem; | |||
export default memo(GifItem); |
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.
저는 주로 memo를
const Component = memo(() => {});
export default Component
이렇게 사용하는데 루루는 export default에서 사용해주셨네요! 혹시 이렇게 사용하시는 이유가 있으신가요?!
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.
큰 변화는 아니지만 컴포넌트 정의 하는 것 자체는 똑같이 하되, 내보낼 때 memo를 감싸게 하여 헷갈리지 않고 간단하게 memo를 적용할 수 있다는 장점이 있다고 생각해서 이렇게 사용합니다ㅎㅎ
new Dotenv() | ||
new Dotenv(), | ||
new MiniCssExtractPlugin(), | ||
new CompressionPlugin({ |
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.
이 플러그인은 어떤 역할을 수행하나요?!
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.
제가 선택한 압축방식으로 코드를 압축해줍니다. 근데 CDN 정책에도 압축방식이 있어서 이렇게 하면 효과가 있는지는 잘 모르겠습니다. CDN을 적용하기 전에 해둔거라ㅎ..
@@ -21,6 +21,8 @@ function convertResponseToModel(gifList: IGif[]): GifImageModel[] { | |||
}); | |||
} | |||
|
|||
let tredingGif: GifsResult | null = null; |
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.
로컬에서 캐싱을 해주기 위해 추가한 로직인가요?! 이렇게 따로 변수를 선언하는 방식을 선택하신 이유가 궁금합니다!
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.
간단한 코드 추가로 캐싱이 가능하기 때문에 선택했습니다. 이렇게 하면 홈페이지가 닫히기 전까지는 계속 값을 가지게 할 수 있으니까요
@@ -0,0 +1,57 @@ | |||
작업 목록 |
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.
깔끔하게 정리해주신 문서 덕분에 리뷰하기 수월했습니다!! 👍👍
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.
남겨주신 답변 모두 확인했습니다!! 고생하셨어요~~
🔥 결과
✅ 개선 작업 목록
1 요청 크기 줄이기
2 필요한 것만 요청하기
3 같은 건 매번 새로 요청하지 않기
4 최소한의 변경만 일으키기
🧐 공유
처음 보는 키워드라 그런지 방법 찾는 부분부터 막혔던 것 같아요. 성능 최적화라고 하면 단순히 렌더링 최적화만 생각했는데 생각보다 더 다양한 방법이 있어서 놀랐어요ㅋㅋ
그래도 퍼포먼스가 찔끔씩 올라가는거 보니까 뿌듯하기도 하고..
다만 WebPageTest를 진행할 때 첫 방문시 LCP를 어떻게 더 줄일 수 있는지는 잘 모르겠어요.. 이미지 크기 때문인가해서 이미지 크기 더 줄여봤는데 소용이 없네요. 혹시 어떤게 문제인지 같이 찾아봐주실 수 있나요?
<link rel="preload" as="image" href="/static/hero.webp" />
를 index.html에 추가한 것으로 조금 줄이긴 했어요! 번들을 불러온 다음 이미지를 요청해서 시간이 오래걸린다고 하네요..!ㅎㅎ..
센트는 어떤 것이 젤 힘들고 재밌었나요?