Webpack

2021. 8. 11. 16:54·Web

 

 

Concept

.js, .css, .sass, .png 등 각종 리소스를 하나의 파일로 번들링하는 도구.

 

Why to use?

  1. Resolve cross-browser issue
  2. Reduce amount of network load by integrating all files to bundling one.

HTTP 1.1 까지는 한 번에 하나의 파일만 요청 - 응답하여 받기 때문에

웹 페이지의 구성파일이 총 100개라고 치면 100번 요청해야한다.

얼마나 비효율적인가?

 

Configure

webpack.config.js || webpack.config.ts

Node.js + Typescript 기반의 프로젝트라면 다음과 같이 설정해볼 수 있다.
모르겠으면 그냥 복붙하자.

 

 

 

공식 문서를 참조한 주석을 상세히 달아놨으니 응용해볼 수 있을 것이다.

 

.ts 로 할 경우 다음과 같은 dependency 설정이 필요하다.

npm 패키지 매니저를 써도 무방하다.

 

 

Output

build 결과는 어떻게 나올까?

 

 

🔗 Reference

 

Introduction To Webpack with Node.js

This article serves as an Introduction to webpack - webpack is a static module bundler for modern JavaScript applications.

www.section.io

 

 

Concepts | webpack

webpack is a module bundler. Its main purpose is to bundle JavaScript files for usage in a browser, yet it is also capable of transforming, bundling, or packaging just about any resource or asset.

webpack.js.org

 

저작자표시 (새창열림)

'Web' 카테고리의 다른 글

URL vs URI  (0) 2022.03.08
Why should we use Short URL  (0) 2022.02.24
https 인증서 (SSL) 발급하기  (0) 2021.03.17
TypeScript + Koa 프로젝트 생성  (0) 2020.12.03
Query String vs Params (Path)  (0) 2020.11.02
'Web' 카테고리의 다른 글
  • URL vs URI
  • Why should we use Short URL
  • https 인증서 (SSL) 발급하기
  • TypeScript + Koa 프로젝트 생성
M_Falcon
M_Falcon
  • M_Falcon
    Falcon
    M_Falcon
  • 전체
    오늘
    어제
    • 분류 전체보기 (432)
      • Web (16)
        • Nodejs (14)
        • Javascript (23)
        • FrontEnd (4)
      • DataBase (39)
        • Fundamental (1)
        • Redis (4)
        • PostgreSQL (10)
        • NoSQL (4)
        • MySQL (9)
        • MSSQL (3)
        • Error (4)
      • Algorithm (79)
        • Algorithm (문제풀이) (56)
        • Algorithm (이론) (23)
      • JVM (65)
        • Spring (13)
        • JPA (5)
        • Kotlin (13)
        • Java (24)
        • Error (7)
      • 기타 (70)
        • Kafka (3)
        • Kubernetes (3)
        • Docker (13)
        • git (19)
        • 잡동사니 (27)
      • 재테크 (11)
        • 세무 (4)
        • 투자 (3)
        • 보험 (0)
      • BlockChain (2)
        • BitCoin (0)
      • C (32)
        • C (10)
        • C++ (17)
        • Error (3)
      • Low Level (8)
        • OS (3)
        • 시스템 보안 (5)
      • 네트워크 (3)
      • LINUX (30)
        • Linux (26)
        • Error (4)
      • 저작권과 스마트폰의 이해 (0)
      • 생각 뭉치 (6)
      • 궁금증 (2)
      • Private (4)
        • 이직 경험 (0)
        • 꿈을 찾아서 (1)
      • Android (21)
        • OS (4)
  • 블로그 메뉴

    • 홈
    • WEB
    • 알고리즘
    • DataBase
    • Linux
    • Mobile
    • C
    • 방명록
  • 링크

    • github
  • 공지사항

  • 인기 글

  • 태그

    ubuntu
    C++
    javascript
    JPA
    database
    linux
    android
    Programmers
    알고리즘
    백준
    Spring
    Kotlin
    algorithm
    docker
    kafka
    Bitcoin
    Git
    PostgreSQL
    java
    프로그래머스
  • hELLO· Designed By정상우.v4.10.3
M_Falcon
Webpack
상단으로

티스토리툴바