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
Cheesecake Labs
August 16, 2018
Programming
0
45
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
58
How do we create the first impressions?
cheesecakelabs
0
67
Menstrual cup: suit and freedom
cheesecakelabs
0
82
Life is a cycle, better with a bicycle
cheesecakelabs
0
68
Interview Process: how to get the best of people
cheesecakelabs
1
100
My capsule wardrobe experience
cheesecakelabs
3
76
Stonewall Rebellion and its impact on LGBTQIA+ history
cheesecakelabs
1
55
Pregnancy, childbirth and breastfeeding: What do I have to do with it?
cheesecakelabs
0
55
MBTI - Psychological types described by Jung
cheesecakelabs
0
150
Other Decks in Programming
See All in Programming
AIに任せる範囲を安全に広げるためにやっていること
fukucheee
0
130
The Past, Present, and Future of Enterprise Java
ivargrimstad
0
470
What Spring Developers Should Know About Jakarta EE
ivargrimstad
0
310
RAGでハマりがちな"Excelの罠"を、データの構造化で突破する
harumiweb
9
2.9k
DSPy入門 Pythonで実現する自動プロンプト最適化 〜人手によるプロンプト調整からの卒業〜
seaturt1e
1
740
Docコメントで始める簡単ガードレール
keisukeikeda
1
120
The Past, Present, and Future of Enterprise Java
ivargrimstad
0
550
maplibre-gl-layers - 地図に移動体たくさん表示したい
kekyo
PRO
0
270
コーディングルールの鮮度を保ちたい / keep-fresh-go-internal-conventions
handlename
0
200
AWS×クラウドネイティブソフトウェア設計 / AWS x Cloud-Native Software Design
nrslib
16
3.2k
Agent Skills Workshop - AIへの頼み方を仕組み化する
gotalab555
15
8.8k
AI時代でも変わらない技術コミュニティの力~10年続く“ゆるい”つながりが生み出す価値
n_takehata
2
750
Featured
See All Featured
Faster Mobile Websites
deanohume
310
31k
Getting science done with accelerated Python computing platforms
jacobtomlinson
2
140
Speed Design
sergeychernyshev
33
1.6k
Bridging the Design Gap: How Collaborative Modelling removes blockers to flow between stakeholders and teams @FastFlow conf
baasie
0
480
The AI Revolution Will Not Be Monopolized: How open-source beats economies of scale, even for LLMs
inesmontani
PRO
3
3.1k
JavaScript: Past, Present, and Future - NDC Porto 2020
reverentgeek
52
5.9k
How to optimise 3,500 product descriptions for ecommerce in one day using ChatGPT
katarinadahlin
PRO
1
3.5k
How to Get Subject Matter Experts Bought In and Actively Contributing to SEO & PR Initiatives.
livdayseo
0
85
Fight the Zombie Pattern Library - RWD Summit 2016
marcelosomers
234
17k
Visual Storytelling: How to be a Superhuman Communicator
reverentgeek
2
470
Primal Persuasion: How to Engage the Brain for Learning That Lasts
tmiket
0
290
技術選定の審美眼(2025年版) / Understanding the Spiral of Technologies 2025 edition
twada
PRO
118
110k
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