Web

[Bundler] Parcel vs Webpack

say! 2022. 10. 19. 11:20
728x90

๐ŸŸก Parcel vs Webpack

- Parcel : ๊ตฌ์„ฑ ์—†๋Š” ๋‹จ์ˆœํ•œ ์ž๋™ ๋ฒˆ๋“ค๋ง, ์†Œ/์ค‘ํ˜• ํ”„๋กœ์ ํŠธ์— ์ ํ•ฉ

- Webpack : ๊ผผ๊ผผํ•œ ๊ตฌ์„ฑ, ์ค‘/๋Œ€ํ˜• ํ”„๋กœ์ ํŠธ์— ์ ํ•ฉ


๐Ÿ”ต Parcel

 

Parcel – The zero configuration build tool for the web.

Parcel combines a great out-of-the-box development experience with a scalable architecture that can take your project from just getting started to massive production application.

parceljs.org

 

- favicon ๋งŒ๋“œ๋Š” ์‚ฌ์ดํŠธ

 

ICO Converter

Converts images to the ICO format for your websites or applications.

www.icoconverter.com

 

- static ํด๋”๋ฅผ dist ํด๋”๋กœ ๋ณต์‚ฌํ•ด์„œ ๋ถ™์—ฌ๋„ฃ์–ด์คŒ

npm i -D parcel-plugin-static-files-cp

package.json ํŒŒ์ผ์—

"staticFiles": {
	"staticPath: "static"
}
 

parcel-plugin-static-files-copy

ParcelJS plugin to copy static files from static dir to bundle directory.. Latest version: 2.6.0, last published: 2 years ago. Start using parcel-plugin-static-files-copy in your project by running `npm i parcel-plugin-static-files-copy`. There are 8 other

www.npmjs.com

 

* ๊ณต๊ธ‰ ์—…์ฒด ์ ‘๋‘์‚ฌ (Vender Prefix)

 

- browserslist ์˜ต์…˜ : ํ˜„์žฌ NPM ํ”„๋กœ์ ํŠธ์—์„œ ์ง€์›ํ•  ๋ธŒ๋ผ์šฐ์ €์˜ ๋ฒ”์œ„๋ฅผ ๋ช…์‹œํ•˜๋Š” ์šฉ๋„

> ํ•ด๋‹น ๋ช…์‹œ๋ฅผ Autoprefixer ํŒจํ‚ค์ง€๊ฐ€ ํ™œ์šฉํ•จ

> package.json ํŒŒ์ผ์— ์•„๋ž˜ ์‚ฝ์ž… (์ „์„ธ๊ณ„ ์ ์œ ์œจ์ด 1%์ด์ƒ์ด๊ณ  ํ•ด๋‹นํ•˜๋Š” ๋ธŒ๋ผ์šฐ์ €์˜ ๋งˆ์ง€๋ง‰ 2๊ฐœ์˜ ๋ฒ„์ „๊นŒ์ง€ ์ง€์›ํ•œ๋‹ค๋Š” ๋œป)

"browerslist": [
	"> 1%",
    "last 2 versions"
]

 

* ํŒŒ์ผ ์ด๋ฆ„ ๋’ค์— rc(Runtime Configuration ์•ฝ์–ด)๊ฐ€ ๋ถ™์€ ํŒŒ์ผ์€ ๊ตฌ์„ฑ ํŒŒ์ผ ์˜๋ฏธํ•จ

 

๐Ÿ”ต Webpack

parcel๊ณผ ๋‹ฌ๋ฆฌ ์ง์ ‘ ๊ตฌ์„ฑ์š”์†Œ ์ž‘์„ฑํ•ด์•ผํ•จ

webpack.config.js๋Š” ๋ธŒ๋ผ์šฐ์ € ํ™˜๊ฒฝ์ด ์•„๋‹Œ node.js ํ™˜๊ฒฝ์—์„œ ๋™์ž‘ํ•จ

html์ด ์•„๋‹Œ ์ž๋ฐ”์Šคํฌ๋ฆฝํŠธ ํŒŒ์ผ์„ ์ง„์ž…์ ์œผ๋กœ ์„ค์ •ํ•จ (์ง„์ž…์  ์—ฌ๋Ÿฌ ๊ฐœ ์„ค์ • ๊ฐ€๋Šฅ)

 

 

Entry and Context | 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