SlideShare a Scribd company logo
Webpack
Bundle your modules with
Jake Peyser

November 2nd, 2016
“The module bundler. That also supports
pre-processing, code splitting, request
caching, automatic reloading…”
• Front end development involves many
repetitive tasks
• Production SPAs require a lot of code
per page
• Scalable web apps require efficient
static content delivery
But…

why?
Output
index.js
webpack.config.js
• Specify your source code
entry point
• Designate your bundled
output destination
The
Basics
Outputindex.js
message.js
• Webpack will crawl the
dependency graph,
starting at your entry
• Creates a single JS file for
each designated bundle
Module
Bundling
webpack.config.js
index.js
App.js
Output
• Transpile source code using
loaders (eg. jsx -> js)
• Chain and automate the
order in which loaders run
• Common functionality is
provided by webpack and
others through plugins
Task Running
& Plugins
Output
webpack.config.js
• Split your code into main and vendor bundles
• Creates a single JS file for each designated bundle
• Cache code that does not change often to
decrease initial page load time
Code
Splitting
• Most popular build tool adopted by the React
community
• Powerful and very heavy on configuration
• create-react-app provides a boilerplate with
nice abstraction
• Most advanced features are not necessary
outside of production
Key
Points
• Webpack: When to Use and Why
• Gulp vs Grunt: Why use task runners and the elegance of plugins
• Create React Apps with No Configuration
• Utilizing Webpack and Babel to build a React.js App
• SurviveJS: Webpack from Apprentice to Master
• Webpack Docs
• Webpack 2.0 Docs (work in progress)
• jakepeyser/webpack-intro
Helpful
Resources
• DedupePlugin - Deduplicate equal or similar files in the output
• UglifyJSPlugin - Minimize all JavaScript output of chunks
• CommonsChunkPlugin - Split code into chunks
• OfflinePlugin - Makes your app offline ready by caching all (or some) output assets
• DefinePlugin - Create global constants which can be configured at compile time
• HotModuleReplacementPlugin - Enables Hot Module Replacement
• HtmlWebpackPlugin - Simplifies creation of HTML files to serve your webpack bundles
Useful
Plugins

More Related Content

PPTX
Improving build solutions dependency management with webpack
NodeXperts
 
PPTX
Packing for the Web with Webpack
Thiago Temple
 
PPTX
Webpack
Anjali Chawla
 
PPTX
Webpack Introduction
Anjali Chawla
 
PDF
Webpack
DataArt
 
PPTX
Bundling your front-end with Webpack
Danillo Corvalan
 
PPTX
An Intro into webpack
Squash Apps Pvt Ltd
 
Improving build solutions dependency management with webpack
NodeXperts
 
Packing for the Web with Webpack
Thiago Temple
 
Webpack
Anjali Chawla
 
Webpack Introduction
Anjali Chawla
 
Webpack
DataArt
 
Bundling your front-end with Webpack
Danillo Corvalan
 
An Intro into webpack
Squash Apps Pvt Ltd
 

What's hot (20)

PDF
Webpack DevTalk
Alessandro Bellini
 
PDF
Webpack: from 0 to 2
Alessandro Bellini
 
PDF
Webpack Tutorial, Uppsala JS
Emil Öberg
 
PPTX
DotNet MVC and webpack + Babel + react
Chen-Tien Tsai
 
PDF
Production optimization with React and Webpack
k88hudson
 
PDF
Webpack: your final module bundler
Andrea Giannantonio
 
PPTX
Webpack and Web Performance Optimization
Chen-Tien Tsai
 
PDF
Packing it all: JavaScript module bundling from 2000 to now
Derek Willian Stavis
 
PPTX
Lecture: Webpack 4
Sergei Iastrebov
 
PDF
Front-end build tools - Webpack
Razvan Rosu
 
PPTX
An Overview on Nuxt.js
Squash Apps Pvt Ltd
 
PDF
Grunt.js and Yeoman, Continous Integration
David Amend
 
PPTX
006. React - Redux framework
Binh Quan Duc
 
PDF
Nuxt.js - Introduction
Sébastien Chopin
 
PPTX
002. Working with Webpack
Binh Quan Duc
 
PPTX
Nuxt Talk
Sébastien Chopin
 
PDF
Nuxt.JS Introdruction
David Ličen
 
PPTX
005. a React project structure
Binh Quan Duc
 
PDF
WordPress development checklist
Binh Quan Duc
 
PDF
Introduction of webpack 4
Vijay Shukla
 
Webpack DevTalk
Alessandro Bellini
 
Webpack: from 0 to 2
Alessandro Bellini
 
Webpack Tutorial, Uppsala JS
Emil Öberg
 
DotNet MVC and webpack + Babel + react
Chen-Tien Tsai
 
Production optimization with React and Webpack
k88hudson
 
Webpack: your final module bundler
Andrea Giannantonio
 
Webpack and Web Performance Optimization
Chen-Tien Tsai
 
Packing it all: JavaScript module bundling from 2000 to now
Derek Willian Stavis
 
Lecture: Webpack 4
Sergei Iastrebov
 
Front-end build tools - Webpack
Razvan Rosu
 
An Overview on Nuxt.js
Squash Apps Pvt Ltd
 
Grunt.js and Yeoman, Continous Integration
David Amend
 
006. React - Redux framework
Binh Quan Duc
 
Nuxt.js - Introduction
Sébastien Chopin
 
002. Working with Webpack
Binh Quan Duc
 
Nuxt.JS Introdruction
David Ličen
 
005. a React project structure
Binh Quan Duc
 
WordPress development checklist
Binh Quan Duc
 
Introduction of webpack 4
Vijay Shukla
 
Ad

Viewers also liked (16)

PPTX
MoscowJS 26 webpack presentation
lgordey
 
PDF
2015-11-07 01 Виталий Кравцов. Webpack: человеческий подход к разработке веб ...
Омские ИТ-субботники
 
PDF
webpack 101 slides
mattysmith
 
PDF
webpack 入門
Anna Su
 
PPTX
Los sistemas operativos
123abraha123
 
PDF
Czym jest webpack i dlaczego chcesz go używać?
Marcin Gajda
 
PPTX
This keyword in java
Hitesh Kumar
 
PPTX
TIPOS DE FRANQUICIAS
lisbeth1319
 
PPTX
Super keyword in java
Hitesh Kumar
 
DOC
Le Hong Hoa - CV
Le Hoa
 
PPTX
Webpack integration
Illia Zub
 
PDF
Hey webpack
Andrew Makarow
 
PDF
"Webpack: 7 бед — один ответ" — Денис Измайлов, MoscowJS 17
MoscowJS
 
PDF
Как Webpack сделал меня счастливее
Yaroslav Serhieiev
 
PDF
Webpack - Czym jest webpack i dlaczego chcesz go używać? - wersja krótka
Marcin Gajda
 
PDF
Honey's Data Dinner#7 webpack 包達人(入門)
beehivedata
 
MoscowJS 26 webpack presentation
lgordey
 
2015-11-07 01 Виталий Кравцов. Webpack: человеческий подход к разработке веб ...
Омские ИТ-субботники
 
webpack 101 slides
mattysmith
 
webpack 入門
Anna Su
 
Los sistemas operativos
123abraha123
 
Czym jest webpack i dlaczego chcesz go używać?
Marcin Gajda
 
This keyword in java
Hitesh Kumar
 
TIPOS DE FRANQUICIAS
lisbeth1319
 
Super keyword in java
Hitesh Kumar
 
Le Hong Hoa - CV
Le Hoa
 
Webpack integration
Illia Zub
 
Hey webpack
Andrew Makarow
 
"Webpack: 7 бед — один ответ" — Денис Измайлов, MoscowJS 17
MoscowJS
 
Как Webpack сделал меня счастливее
Yaroslav Serhieiev
 
Webpack - Czym jest webpack i dlaczego chcesz go używać? - wersja krótka
Marcin Gajda
 
Honey's Data Dinner#7 webpack 包達人(入門)
beehivedata
 
Ad

Similar to Bundle your modules with Webpack (20)

PDF
Shift Remote: JS - Javascript Build Tools: Past & Beyond - Shedrack Akintayo
Shift Conference
 
PPTX
Java script nirvana in netbeans [con5679]
Ryan Cuprak
 
PDF
Installing Webpack with React JS from Scratch.pdf
Sufalam Technologies
 
PPTX
Webpack/Parcel: What’s Happening Behind the React App?
Talentica Software
 
PPTX
CT Software Developers Meetup: Using Docker and Vagrant Within A GitHub Pull ...
E. Camden Fisher
 
PPTX
GDG Workshop on React (By Aakanksha Rai)
gdgoncampuslncts
 
PPTX
Agile sites2
Michele Sciabarrà
 
PPTX
Introduction to ASP.NET 5
mbaric
 
PDF
Webpack 살펴보기
Sangwon Lee
 
PPTX
ASP.NET vNext
Alex Thissen
 
PPTX
Building JavaScript
Brady Clifford
 
PDF
introduction to Vue.js 3
ArezooKmn
 
PDF
MEAN Stack Warm-up
Troy Miles
 
PPTX
SharePoint Framework - Developer Preview
Sean McLellan
 
PDF
How to generate a REST CXF3 application from Swagger ApacheConEU 2016
johannes_fiala
 
PDF
UKLUG 2012 - XPages, Beyond the basics
Ulrich Krause
 
PPTX
Short-Training asp.net vNext
Betclic Everest Group Tech Team
 
PDF
React Tech Salon
Chenguang ZHANG
 
PDF
DrupalSouth 2015 - Performance: Not an Afterthought
Nick Santamaria
 
PDF
White Paper : ASP.NET Core AngularJs 2 and Prime
Hamida Rebai Trabelsi
 
Shift Remote: JS - Javascript Build Tools: Past & Beyond - Shedrack Akintayo
Shift Conference
 
Java script nirvana in netbeans [con5679]
Ryan Cuprak
 
Installing Webpack with React JS from Scratch.pdf
Sufalam Technologies
 
Webpack/Parcel: What’s Happening Behind the React App?
Talentica Software
 
CT Software Developers Meetup: Using Docker and Vagrant Within A GitHub Pull ...
E. Camden Fisher
 
GDG Workshop on React (By Aakanksha Rai)
gdgoncampuslncts
 
Agile sites2
Michele Sciabarrà
 
Introduction to ASP.NET 5
mbaric
 
Webpack 살펴보기
Sangwon Lee
 
ASP.NET vNext
Alex Thissen
 
Building JavaScript
Brady Clifford
 
introduction to Vue.js 3
ArezooKmn
 
MEAN Stack Warm-up
Troy Miles
 
SharePoint Framework - Developer Preview
Sean McLellan
 
How to generate a REST CXF3 application from Swagger ApacheConEU 2016
johannes_fiala
 
UKLUG 2012 - XPages, Beyond the basics
Ulrich Krause
 
Short-Training asp.net vNext
Betclic Everest Group Tech Team
 
React Tech Salon
Chenguang ZHANG
 
DrupalSouth 2015 - Performance: Not an Afterthought
Nick Santamaria
 
White Paper : ASP.NET Core AngularJs 2 and Prime
Hamida Rebai Trabelsi
 

Recently uploaded (20)

PDF
CAD-CAM U-1 Combined Notes_57761226_2025_04_22_14_40.pdf
shailendrapratap2002
 
PDF
Unit I Part II.pdf : Security Fundamentals
Dr. Madhuri Jawale
 
PDF
EVS+PRESENTATIONS EVS+PRESENTATIONS like
saiyedaqib429
 
PDF
Zero carbon Building Design Guidelines V4
BassemOsman1
 
PDF
Machine Learning All topics Covers In This Single Slides
AmritTiwari19
 
PDF
Zero Carbon Building Performance standard
BassemOsman1
 
PPTX
Tunnel Ventilation System in Kanpur Metro
220105053
 
PPTX
MULTI LEVEL DATA TRACKING USING COOJA.pptx
dollysharma12ab
 
PPTX
MSME 4.0 Template idea hackathon pdf to understand
alaudeenaarish
 
PPTX
Information Retrieval and Extraction - Module 7
premSankar19
 
PDF
2025 Laurence Sigler - Advancing Decision Support. Content Management Ecommer...
Francisco Javier Mora Serrano
 
PDF
Biodegradable Plastics: Innovations and Market Potential (www.kiu.ac.ug)
publication11
 
PPTX
22PCOAM21 Session 1 Data Management.pptx
Guru Nanak Technical Institutions
 
PPTX
Civil Engineering Practices_BY Sh.JP Mishra 23.09.pptx
bineetmishra1990
 
PPTX
FUNDAMENTALS OF ELECTRIC VEHICLES UNIT-1
MikkiliSuresh
 
PDF
67243-Cooling and Heating & Calculation.pdf
DHAKA POLYTECHNIC
 
PPTX
Victory Precisions_Supplier Profile.pptx
victoryprecisions199
 
PDF
Cryptography and Information :Security Fundamentals
Dr. Madhuri Jawale
 
PPTX
Module2 Data Base Design- ER and NF.pptx
gomathisankariv2
 
PPTX
MT Chapter 1.pptx- Magnetic particle testing
ABCAnyBodyCanRelax
 
CAD-CAM U-1 Combined Notes_57761226_2025_04_22_14_40.pdf
shailendrapratap2002
 
Unit I Part II.pdf : Security Fundamentals
Dr. Madhuri Jawale
 
EVS+PRESENTATIONS EVS+PRESENTATIONS like
saiyedaqib429
 
Zero carbon Building Design Guidelines V4
BassemOsman1
 
Machine Learning All topics Covers In This Single Slides
AmritTiwari19
 
Zero Carbon Building Performance standard
BassemOsman1
 
Tunnel Ventilation System in Kanpur Metro
220105053
 
MULTI LEVEL DATA TRACKING USING COOJA.pptx
dollysharma12ab
 
MSME 4.0 Template idea hackathon pdf to understand
alaudeenaarish
 
Information Retrieval and Extraction - Module 7
premSankar19
 
2025 Laurence Sigler - Advancing Decision Support. Content Management Ecommer...
Francisco Javier Mora Serrano
 
Biodegradable Plastics: Innovations and Market Potential (www.kiu.ac.ug)
publication11
 
22PCOAM21 Session 1 Data Management.pptx
Guru Nanak Technical Institutions
 
Civil Engineering Practices_BY Sh.JP Mishra 23.09.pptx
bineetmishra1990
 
FUNDAMENTALS OF ELECTRIC VEHICLES UNIT-1
MikkiliSuresh
 
67243-Cooling and Heating & Calculation.pdf
DHAKA POLYTECHNIC
 
Victory Precisions_Supplier Profile.pptx
victoryprecisions199
 
Cryptography and Information :Security Fundamentals
Dr. Madhuri Jawale
 
Module2 Data Base Design- ER and NF.pptx
gomathisankariv2
 
MT Chapter 1.pptx- Magnetic particle testing
ABCAnyBodyCanRelax
 

Bundle your modules with Webpack

  • 1. Webpack Bundle your modules with Jake Peyser
 November 2nd, 2016
  • 2. “The module bundler. That also supports pre-processing, code splitting, request caching, automatic reloading…”
  • 3. • Front end development involves many repetitive tasks • Production SPAs require a lot of code per page • Scalable web apps require efficient static content delivery But…
 why?
  • 4. Output index.js webpack.config.js • Specify your source code entry point • Designate your bundled output destination The Basics
  • 5. Outputindex.js message.js • Webpack will crawl the dependency graph, starting at your entry • Creates a single JS file for each designated bundle Module Bundling
  • 6. webpack.config.js index.js App.js Output • Transpile source code using loaders (eg. jsx -> js) • Chain and automate the order in which loaders run • Common functionality is provided by webpack and others through plugins Task Running & Plugins
  • 7. Output webpack.config.js • Split your code into main and vendor bundles • Creates a single JS file for each designated bundle • Cache code that does not change often to decrease initial page load time Code Splitting
  • 8. • Most popular build tool adopted by the React community • Powerful and very heavy on configuration • create-react-app provides a boilerplate with nice abstraction • Most advanced features are not necessary outside of production Key Points
  • 9. • Webpack: When to Use and Why • Gulp vs Grunt: Why use task runners and the elegance of plugins • Create React Apps with No Configuration • Utilizing Webpack and Babel to build a React.js App • SurviveJS: Webpack from Apprentice to Master • Webpack Docs • Webpack 2.0 Docs (work in progress) • jakepeyser/webpack-intro Helpful Resources
  • 10. • DedupePlugin - Deduplicate equal or similar files in the output • UglifyJSPlugin - Minimize all JavaScript output of chunks • CommonsChunkPlugin - Split code into chunks • OfflinePlugin - Makes your app offline ready by caching all (or some) output assets • DefinePlugin - Create global constants which can be configured at compile time • HotModuleReplacementPlugin - Enables Hot Module Replacement • HtmlWebpackPlugin - Simplifies creation of HTML files to serve your webpack bundles Useful Plugins