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
56
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Webpack Fundamentals
Beatriz Silveira
Cheesecake Labs
August 16, 2018
More Decks by Cheesecake Labs
See All by Cheesecake Labs
Cats' wellness & care
cheesecakelabs
0
73
How do we create the first impressions?
cheesecakelabs
0
79
Menstrual cup: suit and freedom
cheesecakelabs
0
98
Life is a cycle, better with a bicycle
cheesecakelabs
0
81
Interview Process: how to get the best of people
cheesecakelabs
1
130
My capsule wardrobe experience
cheesecakelabs
3
88
Stonewall Rebellion and its impact on LGBTQIA+ history
cheesecakelabs
1
65
Pregnancy, childbirth and breastfeeding: What do I have to do with it?
cheesecakelabs
0
67
MBTI - Psychological types described by Jung
cheesecakelabs
0
170
Other Decks in Programming
See All in Programming
[2026年度第1回ORセミナー] 計画最適化ベンチャーと競技プログラミング人材
terryu16
0
250
Make SRE Operations Easier with Azure SRE Agent
kkamegawa
0
4.5k
Composerを使ったサプライチェーン攻撃の様子を眺めてみる #phpstudy
o0h
PRO
2
230
Datadog × OpenTelemetry 入門と実践のあいだ
kn_to_maxpno
1
150
Inside Stream API
skrb
1
650
Copilot CLI の継戦能力を高める コンテキスト管理
nozomutu
1
1.2k
ユニットテストの先へ:テスト技法で要求・仕様を整理するJava開発実践 / Beyond_Unit_Testing_Practical_Java_Development_Techniques_for_Organizing_Requirements_and_Specifications
shimashima35
0
370
PHPで使える日時の表現と、その知り方 #frontend_phpcon_do
o0h
PRO
0
200
AI駆動開発で崩れていくコードベースを立て直す
kyoko_nr_nr
1
440
Lemonade + Foundry Toolkit でお手軽アプリ開発
seosoft
1
310
Modding RubyKaigi for Myself
yui_knk
0
900
AIで効率化できた業務・日常
ochtum
0
110
Featured
See All Featured
技術選定の審美眼(2025年版) / Understanding the Spiral of Technologies 2025 edition
twada
PRO
118
120k
Between Models and Reality
mayunak
4
330
Building Flexible Design Systems
yeseniaperezcruz
330
40k
Designing for humans not robots
tammielis
254
26k
Heart Work Chapter 1 - Part 1
lfama
PRO
7
36k
Accessibility Awareness
sabderemane
1
130
What’s in a name? Adding method to the madness
productmarketing
PRO
24
4.1k
How People are Using Generative and Agentic AI to Supercharge Their Products, Projects, Services and Value Streams Today
helenjbeal
1
200
Principles of Awesome APIs and How to Build Them.
keavy
128
17k
Making Projects Easy
brettharned
120
6.7k
The Language of Interfaces
destraynor
162
27k
Rails Girls Zürich Keynote
gr2m
96
14k
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