HomeAboutMeBlogGuest
© 2025 Sejin Cha. All rights reserved.
Built with Next.js, deployed on Vercel
🧚
[1기]최종 프로젝트 데브코스
/
[팀7] 뿡치와 삼촌들 - Devnity
[팀7] 뿡치와 삼촌들 - Devnity
/
📘
프론트엔드 공간
/
🧑‍🎓
Today We Learned
/
Why style-loader used in webpack5 development mode
Why style-loader used in webpack5 development mode
Why style-loader used in webpack5 development mode

Why style-loader used in webpack5 development mode

생성일
Dec 3, 2021 06:44 AM
기록자
해결 여부
해결 여부
속성
webpack
카테고리
개발 환경 세팅
💡
For production builds it's recommended to extract the CSS from your bundle being able to use parallel loading of CSS/JS resources later on. This can be achieved by using the mini-css-extract-plugin, because it creates separate css files. For development mode (including webpack-dev-server) you can use style-loader, because it injects CSS into the DOM using multiple <style></style> and works faster.
 

배포: style-loader < mini-css-extract-plugin

나중에 CSS/JS를 병렬적으로 로딩하기 위해 사용할 수 있는 별개의 CSS 모듈로 추출하는 것이 더욱 좋기 때문에 mini-css-extract-plugin을 선호한다.
 

개발: style-loader > mini-css-extract-plugin

개발 모드에서는 (webpack-dev-server)인라인 파일에 대해서는 DOM에 CSS를 주입시키는 것이 좋다. 왜냐하면 DOM 안에 여러 개의 style 태그를 주입시켜주기 때문에, 작동 자체에 있어서 빠르기 때문이다.
 

📃 참고자료

https://webpack.js.org/plugins/mini-css-extract-plugin/