Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Webpack Fundamentals
Search
Sponsored
·
SiteGround - Reliable hosting with speed, security, and support you can count on.
→
Cheesecake Labs
August 16, 2018
Programming
0
47
Webpack Fundamentals
Beatriz Silveira
Cheesecake Labs
August 16, 2018
Tweet
Share
More Decks by Cheesecake Labs
See All by Cheesecake Labs
Cats' wellness & care
cheesecakelabs
0
61
How do we create the first impressions?
cheesecakelabs
0
69
Menstrual cup: suit and freedom
cheesecakelabs
0
83
Life is a cycle, better with a bicycle
cheesecakelabs
0
69
Interview Process: how to get the best of people
cheesecakelabs
1
110
My capsule wardrobe experience
cheesecakelabs
3
77
Stonewall Rebellion and its impact on LGBTQIA+ history
cheesecakelabs
1
56
Pregnancy, childbirth and breastfeeding: What do I have to do with it?
cheesecakelabs
0
57
MBTI - Psychological types described by Jung
cheesecakelabs
0
150
Other Decks in Programming
See All in Programming
Nuxt Server Components
wattanx
0
130
KagglerがMixSeekを触ってみた
morim
0
320
今からFlash開発できるわけないじゃん、ムリムリ! (※ムリじゃなかった!?)
arkw
0
150
Angular-Apps smarter machen mit Gen AI: Lokal und offlinefähig - Hands-on Workshop!
christianliebel
PRO
0
140
Rで始めるML・LLM活用入門
wakamatsu_takumu
0
210
DevinとClaude Code、SREの現場で使い倒してみた件
karia
1
1.1k
ロボットのための工場に灯りは要らない
watany
12
3.2k
存在論的プログラミング: 時間と存在を記述する
koriym
5
510
Java 21/25 Virtual Threads 소개
debop
0
280
AI時代の脳疲弊と向き合う ~言語学としてのPHP~
sakuraikotone
1
1.6k
車輪の再発明をしよう!PHP で実装して学ぶ、Web サーバーの仕組みと HTTP の正体
h1r0
2
400
Claude Codeログ基盤の構築
giginet
PRO
7
3.7k
Featured
See All Featured
Code Reviewing Like a Champion
maltzj
528
40k
Breaking role norms: Why Content Design is so much more than writing copy - Taylor Woolridge
uxyall
0
220
[SF Ruby Conf 2025] Rails X
palkan
2
860
The MySQL Ecosystem @ GitHub 2015
samlambert
251
13k
Groundhog Day: Seeking Process in Gaming for Health
codingconduct
0
130
Taking LLMs out of the black box: A practical guide to human-in-the-loop distillation
inesmontani
PRO
3
2.1k
The Pragmatic Product Professional
lauravandoore
37
7.2k
[Rails World 2023 - Day 1 Closing Keynote] - The Magic of Rails
eileencodes
38
2.8k
Keith and Marios Guide to Fast Websites
keithpitt
413
23k
Responsive Adventures: Dirty Tricks From The Dark Corners of Front-End
smashingmag
254
22k
Organizational Design Perspectives: An Ontology of Organizational Design Elements
kimpetersen
PRO
1
650
XXLCSS - How to scale CSS and keep your sanity
sugarenia
249
1.3M
Transcript
Webpack Fundamentals
Origins
JS it's just scripts
Inline Script
Problems • Doesn't Scale • Too many Scripts • Performance
Problems • Unmaintainable Scripts • Scope • Size • Readability • Fragility
IIFE's - Immediately Invoked Function Expression
IIFE's • Full rebuilds every time • Lots of IIFE's
are slow
How to import JS on Backend? COMMON JS
CommonJS -> NodeJS
JavaScript Modules CommonJS
JavaScript Modules Was too popular, but how to use this
on Browser Commonjs is synchronous !!! No browser support !!! CommonJS
AMD To transfer module syntax from server usage to browser
usage, CommonJS proposed AMD - Asynchronous Module Definition
AMD But, How can I use it ?
RequireJS • Is a JavaScript module loader. • It helps
load modules asynchronously as needed • You can write AMD style module
RequireJS
Browserify • With Browserify, you can use CommonJS module in
browser application • Traverse the dependency tree of your codes and bundle them up in a single file
Browserify
ES6 Module Syntax • Browsers are not ready for this
new syntax. • There are tools available. These tools allow us to use ES6 module syntax today.
Webpack • Webpack is a module bundler. • If it
is the same as Browserify, why would we need yet another module bundler? • Webpack can handle CommonJS, AMD and ES6 modules.
The Core Concepts • Entry • Output • Loaders •
Plugins
Entry Default ./src/index.js webpack.config.js
Output Default ./dist/main.js
Loaders & Rules test A regular expression that instructs the
compiler which files to run the loader against. use An array/string/function that returns loader objects.
Chaining Loaders less-loader css-loader style-loader style.less style.css *.js Inline style
Plugins Allow you to hook into the entire compilation lifecycle
Add new instance of plugin to plugins key in config object
Using during development 1. Webpack's watch mode 2. webpack-dev-server
Webpack's Watch Mode npm run watch
webpack -dev-server webpack.config.js
webpack -dev-server package.json
Tree Shaking Dead-code elimination
Tree Shaking
Tree Shaking
Production Goal - Improve load time 1. Minified bundles 2.
Lighter weight source maps 3. Optimized assets It's recommend writing separate webpack configurations for each environment