SlideShare a Scribd company logo
1 of 11
06/21/17 www.snipe.co.in 1
Prepared :Snipe Team
06/21/17 2
Webpack
• What is Webpack ?
• What does Webpack do ?
• Why should I use Webpack ?
• How do i use Webpack ?
06/21/17 3
Contents
06/21/17 4
What is Webpack ?

Webpack is a module bundler. It takes modules with
dependencies and generates static assets representing those
modules.

You can use webpack for both your client side JS files as well
as your server side node JS files.
06/21/17 5
What does webpack do?

Manage dependencies
•
require
•
import (e.g. CommonJS, AMD, ES6, etc.)

Build tasks - convert and preprocess
•
Minify
•
Combine
•
Sass / less conversion
•
Babel transpile

It combines the build system and module bundling, i.e. instead of
building sass and optimizing images in one part of project, and then
combining the script files in another, it combines everything in the
module itself.
06/21/17 6
Why should I use webpack ?
Code Splitting :

Split the dependency tree into chunks and load on demand

Maintain the dependency tree

Create chunks of the modules and load them from webpack
runtime environment

Reduce initial loading time

Reduce the number of HTTP requests / for HTTP 2.0 use
plugins to reduce the chunk size to optimize it for caching

Optimize the combined file so as to reduce the load time, while
ensuring avoiding of code redundancy.
06/21/17
Webpack.config.js
Multiple entry points

It will build multiple bundles at once. Additional chunks can be
shared between these entry chunks and modules are only built once.

Every entry chunk contains the webpack runtime.
{
entry: {
a: "./a",
b: "./b",
c: ["./c", "./d"]
},
output: {
path: path.join(__dirname, "dist"),
filename: "[name].entry.js"
}
}
06/21/17 8
Loaders

Functions (running in node.js) that take the source of a resource file as
the parameter and return the new source.

Loaders can be chained and the final loader is expected to return
JavaScript. They are applied right to left.
module: {
loaders: [
{ test: /.css$/,
loader: "style!css"
}
]
}
06/21/17 9
Getting started
$ npm install webpack –g
webpack // for building once for development
webpack -p // for building once for production (minification)
webpack --watch // for continuous incremental build in development (fast!)
06/21/17 10
Documentation:http://webpack.github.io/docs/
Loaders:http://webpack.github.io/docs/list-of-loaders.html
References
06/21/17 11

More Related Content

What's hot

ASP.NET Scalability - NxtGen Oxford
ASP.NET Scalability - NxtGen OxfordASP.NET Scalability - NxtGen Oxford
ASP.NET Scalability - NxtGen Oxford
Phil Pursglove
 
Post-relational databases: What's wrong with web development?
Post-relational databases: What's wrong with web development?Post-relational databases: What's wrong with web development?
Post-relational databases: What's wrong with web development?
Dobrica Pavlinušić
 

What's hot (20)

OpenCms Days 2015 Next generation repository
OpenCms Days 2015  Next generation repositoryOpenCms Days 2015  Next generation repository
OpenCms Days 2015 Next generation repository
 
Compress
CompressCompress
Compress
 
NOSQL - not only sql
NOSQL - not only sqlNOSQL - not only sql
NOSQL - not only sql
 
Performance on Rails
Performance on RailsPerformance on Rails
Performance on Rails
 
Improving Development and Deployment with Docker
Improving Development and Deployment with DockerImproving Development and Deployment with Docker
Improving Development and Deployment with Docker
 
COSCUP 2019 - The discussion between Knex.js and PostgreSQL
COSCUP 2019 - The discussion between Knex.js and PostgreSQLCOSCUP 2019 - The discussion between Knex.js and PostgreSQL
COSCUP 2019 - The discussion between Knex.js and PostgreSQL
 
ASP.NET Scalability - NxtGen Oxford
ASP.NET Scalability - NxtGen OxfordASP.NET Scalability - NxtGen Oxford
ASP.NET Scalability - NxtGen Oxford
 
Post-relational databases: What's wrong with web development? v3
Post-relational databases: What's wrong with web development? v3Post-relational databases: What's wrong with web development? v3
Post-relational databases: What's wrong with web development? v3
 
Post-relational databases: What's wrong with web development?
Post-relational databases: What's wrong with web development?Post-relational databases: What's wrong with web development?
Post-relational databases: What's wrong with web development?
 
Web Performance Part 3 "Server-side tips"
Web Performance Part 3  "Server-side tips"Web Performance Part 3  "Server-side tips"
Web Performance Part 3 "Server-side tips"
 
WebAPI::DBIC - Automated RESTful API's
WebAPI::DBIC - Automated RESTful API'sWebAPI::DBIC - Automated RESTful API's
WebAPI::DBIC - Automated RESTful API's
 
OpenCms Days 2016: Next generation content repository
OpenCms Days 2016: Next generation content repository OpenCms Days 2016: Next generation content repository
OpenCms Days 2016: Next generation content repository
 
Gutenberg: You Can't Teach an Old Dev New Tricks - WordCamp Chicago 2018
Gutenberg: You Can't Teach an Old Dev New Tricks - WordCamp Chicago 2018Gutenberg: You Can't Teach an Old Dev New Tricks - WordCamp Chicago 2018
Gutenberg: You Can't Teach an Old Dev New Tricks - WordCamp Chicago 2018
 
Gatsby (Code.Talks) 2019
Gatsby (Code.Talks) 2019Gatsby (Code.Talks) 2019
Gatsby (Code.Talks) 2019
 
Introduction to Javascript
Introduction to JavascriptIntroduction to Javascript
Introduction to Javascript
 
Relevance trilogy may dream be with you! (dec17)
Relevance trilogy  may dream be with you! (dec17)Relevance trilogy  may dream be with you! (dec17)
Relevance trilogy may dream be with you! (dec17)
 
NoSQL solutions
NoSQL solutionsNoSQL solutions
NoSQL solutions
 
Get MEAN! Node.js and the MEAN stack
Get MEAN!  Node.js and the MEAN stackGet MEAN!  Node.js and the MEAN stack
Get MEAN! Node.js and the MEAN stack
 
AMIS ADF Weblogic 12c launch Event 08 DVT And Websockets by Lucas Jellema
AMIS ADF Weblogic 12c launch Event 08  DVT And Websockets by Lucas JellemaAMIS ADF Weblogic 12c launch Event 08  DVT And Websockets by Lucas Jellema
AMIS ADF Weblogic 12c launch Event 08 DVT And Websockets by Lucas Jellema
 
Rapid Application Development with MEAN Stack
Rapid Application Development with MEAN StackRapid Application Development with MEAN Stack
Rapid Application Development with MEAN Stack
 

Similar to Webpack

webpack introductionNotice Demystifyingf
webpack introductionNotice Demystifyingfwebpack introductionNotice Demystifyingf
webpack introductionNotice Demystifyingf
MrVMNair
 

Similar to Webpack (20)

Webpack Introduction
Webpack IntroductionWebpack Introduction
Webpack Introduction
 
webpack introductionNotice Demystifyingf
webpack introductionNotice Demystifyingfwebpack introductionNotice Demystifyingf
webpack introductionNotice Demystifyingf
 
Webpack
WebpackWebpack
Webpack
 
Improving build solutions dependency management with webpack
Improving build solutions  dependency management with webpackImproving build solutions  dependency management with webpack
Improving build solutions dependency management with webpack
 
Front-end build tools - Webpack
Front-end build tools - WebpackFront-end build tools - Webpack
Front-end build tools - Webpack
 
Warsaw Frontend Meetup #1 - Webpack
Warsaw Frontend Meetup #1 - WebpackWarsaw Frontend Meetup #1 - Webpack
Warsaw Frontend Meetup #1 - Webpack
 
Introduction of webpack 4
Introduction of webpack 4Introduction of webpack 4
Introduction of webpack 4
 
Introduction to Webpack 5.0 Presentation
Introduction to Webpack 5.0 PresentationIntroduction to Webpack 5.0 Presentation
Introduction to Webpack 5.0 Presentation
 
Reactjs Basics
Reactjs BasicsReactjs Basics
Reactjs Basics
 
vitepress-en.pdf
vitepress-en.pdfvitepress-en.pdf
vitepress-en.pdf
 
WEBPACK
WEBPACKWEBPACK
WEBPACK
 
Webpack Encore - Asset Management for the rest of us
Webpack Encore - Asset Management for the rest of usWebpack Encore - Asset Management for the rest of us
Webpack Encore - Asset Management for the rest of us
 
Introduction to node js - From "hello world" to deploying on azure
Introduction to node js - From "hello world" to deploying on azureIntroduction to node js - From "hello world" to deploying on azure
Introduction to node js - From "hello world" to deploying on azure
 
Webpack and Web Performance Optimization
Webpack and Web Performance OptimizationWebpack and Web Performance Optimization
Webpack and Web Performance Optimization
 
EWD 3 Training Course Part 1: How Node.js Integrates With Global Storage Data...
EWD 3 Training Course Part 1: How Node.js Integrates With Global Storage Data...EWD 3 Training Course Part 1: How Node.js Integrates With Global Storage Data...
EWD 3 Training Course Part 1: How Node.js Integrates With Global Storage Data...
 
Installing Webpack with React JS from Scratch.pdf
Installing Webpack with React JS from Scratch.pdfInstalling Webpack with React JS from Scratch.pdf
Installing Webpack with React JS from Scratch.pdf
 
DrupalCampLA 2011 - Drupal frontend-optimizing
DrupalCampLA 2011 - Drupal frontend-optimizingDrupalCampLA 2011 - Drupal frontend-optimizing
DrupalCampLA 2011 - Drupal frontend-optimizing
 
Locker Service Ready Lightning Components With Webpack
Locker Service Ready Lightning Components With WebpackLocker Service Ready Lightning Components With Webpack
Locker Service Ready Lightning Components With Webpack
 
DotNet MVC and webpack + Babel + react
DotNet MVC and webpack + Babel + reactDotNet MVC and webpack + Babel + react
DotNet MVC and webpack + Babel + react
 
your browser, my storage
your browser, my storageyour browser, my storage
your browser, my storage
 

More from Mallikarjuna G D

More from Mallikarjuna G D (20)

Reactjs
ReactjsReactjs
Reactjs
 
Bootstrap 5 ppt
Bootstrap 5 pptBootstrap 5 ppt
Bootstrap 5 ppt
 
CSS
CSSCSS
CSS
 
Angular 2.0
Angular  2.0Angular  2.0
Angular 2.0
 
Spring andspringboot training
Spring andspringboot trainingSpring andspringboot training
Spring andspringboot training
 
Hibernate
HibernateHibernate
Hibernate
 
Jspprogramming
JspprogrammingJspprogramming
Jspprogramming
 
Servlet programming
Servlet programmingServlet programming
Servlet programming
 
Servlet programming
Servlet programmingServlet programming
Servlet programming
 
Mmg logistics edu-final
Mmg  logistics edu-finalMmg  logistics edu-final
Mmg logistics edu-final
 
Interview preparation net_asp_csharp
Interview preparation net_asp_csharpInterview preparation net_asp_csharp
Interview preparation net_asp_csharp
 
Interview preparation devops
Interview preparation devopsInterview preparation devops
Interview preparation devops
 
Interview preparation testing
Interview preparation testingInterview preparation testing
Interview preparation testing
 
Interview preparation data_science
Interview preparation data_scienceInterview preparation data_science
Interview preparation data_science
 
Interview preparation full_stack_java
Interview preparation full_stack_javaInterview preparation full_stack_java
Interview preparation full_stack_java
 
Enterprunership
EnterprunershipEnterprunership
Enterprunership
 
Core java
Core javaCore java
Core java
 
Type script
Type scriptType script
Type script
 
Angularj2.0
Angularj2.0Angularj2.0
Angularj2.0
 
Git Overview
Git OverviewGit Overview
Git Overview
 

Recently uploaded

Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdf
ciinovamais
 
1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdf
QucHHunhnh
 
An Overview of Mutual Funds Bcom Project.pdf
An Overview of Mutual Funds Bcom Project.pdfAn Overview of Mutual Funds Bcom Project.pdf
An Overview of Mutual Funds Bcom Project.pdf
SanaAli374401
 
Making and Justifying Mathematical Decisions.pdf
Making and Justifying Mathematical Decisions.pdfMaking and Justifying Mathematical Decisions.pdf
Making and Justifying Mathematical Decisions.pdf
Chris Hunter
 
Gardella_PRCampaignConclusion Pitch Letter
Gardella_PRCampaignConclusion Pitch LetterGardella_PRCampaignConclusion Pitch Letter
Gardella_PRCampaignConclusion Pitch Letter
MateoGardella
 

Recently uploaded (20)

Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdf
 
Código Creativo y Arte de Software | Unidad 1
Código Creativo y Arte de Software | Unidad 1Código Creativo y Arte de Software | Unidad 1
Código Creativo y Arte de Software | Unidad 1
 
Application orientated numerical on hev.ppt
Application orientated numerical on hev.pptApplication orientated numerical on hev.ppt
Application orientated numerical on hev.ppt
 
Unit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptxUnit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptx
 
1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdf
 
Unit-IV; Professional Sales Representative (PSR).pptx
Unit-IV; Professional Sales Representative (PSR).pptxUnit-IV; Professional Sales Representative (PSR).pptx
Unit-IV; Professional Sales Representative (PSR).pptx
 
Measures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SDMeasures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SD
 
Key note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdfKey note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdf
 
Unit-V; Pricing (Pharma Marketing Management).pptx
Unit-V; Pricing (Pharma Marketing Management).pptxUnit-V; Pricing (Pharma Marketing Management).pptx
Unit-V; Pricing (Pharma Marketing Management).pptx
 
psychiatric nursing HISTORY COLLECTION .docx
psychiatric  nursing HISTORY  COLLECTION  .docxpsychiatric  nursing HISTORY  COLLECTION  .docx
psychiatric nursing HISTORY COLLECTION .docx
 
Mehran University Newsletter Vol-X, Issue-I, 2024
Mehran University Newsletter Vol-X, Issue-I, 2024Mehran University Newsletter Vol-X, Issue-I, 2024
Mehran University Newsletter Vol-X, Issue-I, 2024
 
An Overview of Mutual Funds Bcom Project.pdf
An Overview of Mutual Funds Bcom Project.pdfAn Overview of Mutual Funds Bcom Project.pdf
An Overview of Mutual Funds Bcom Project.pdf
 
Making and Justifying Mathematical Decisions.pdf
Making and Justifying Mathematical Decisions.pdfMaking and Justifying Mathematical Decisions.pdf
Making and Justifying Mathematical Decisions.pdf
 
Advance Mobile Application Development class 07
Advance Mobile Application Development class 07Advance Mobile Application Development class 07
Advance Mobile Application Development class 07
 
Ecological Succession. ( ECOSYSTEM, B. Pharmacy, 1st Year, Sem-II, Environmen...
Ecological Succession. ( ECOSYSTEM, B. Pharmacy, 1st Year, Sem-II, Environmen...Ecological Succession. ( ECOSYSTEM, B. Pharmacy, 1st Year, Sem-II, Environmen...
Ecological Succession. ( ECOSYSTEM, B. Pharmacy, 1st Year, Sem-II, Environmen...
 
Web & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdfWeb & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdf
 
ICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptxICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptx
 
Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptxBasic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
 
Z Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot GraphZ Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot Graph
 
Gardella_PRCampaignConclusion Pitch Letter
Gardella_PRCampaignConclusion Pitch LetterGardella_PRCampaignConclusion Pitch Letter
Gardella_PRCampaignConclusion Pitch Letter
 

Webpack

  • 3. • What is Webpack ? • What does Webpack do ? • Why should I use Webpack ? • How do i use Webpack ? 06/21/17 3 Contents
  • 4. 06/21/17 4 What is Webpack ?  Webpack is a module bundler. It takes modules with dependencies and generates static assets representing those modules.  You can use webpack for both your client side JS files as well as your server side node JS files.
  • 5. 06/21/17 5 What does webpack do?  Manage dependencies • require • import (e.g. CommonJS, AMD, ES6, etc.)  Build tasks - convert and preprocess • Minify • Combine • Sass / less conversion • Babel transpile  It combines the build system and module bundling, i.e. instead of building sass and optimizing images in one part of project, and then combining the script files in another, it combines everything in the module itself.
  • 6. 06/21/17 6 Why should I use webpack ? Code Splitting :  Split the dependency tree into chunks and load on demand  Maintain the dependency tree  Create chunks of the modules and load them from webpack runtime environment  Reduce initial loading time  Reduce the number of HTTP requests / for HTTP 2.0 use plugins to reduce the chunk size to optimize it for caching  Optimize the combined file so as to reduce the load time, while ensuring avoiding of code redundancy.
  • 7. 06/21/17 Webpack.config.js Multiple entry points  It will build multiple bundles at once. Additional chunks can be shared between these entry chunks and modules are only built once.  Every entry chunk contains the webpack runtime. { entry: { a: "./a", b: "./b", c: ["./c", "./d"] }, output: { path: path.join(__dirname, "dist"), filename: "[name].entry.js" } }
  • 8. 06/21/17 8 Loaders  Functions (running in node.js) that take the source of a resource file as the parameter and return the new source.  Loaders can be chained and the final loader is expected to return JavaScript. They are applied right to left. module: { loaders: [ { test: /.css$/, loader: "style!css" } ] }
  • 9. 06/21/17 9 Getting started $ npm install webpack –g webpack // for building once for development webpack -p // for building once for production (minification) webpack --watch // for continuous incremental build in development (fast!)