Webpack

DataArt
DataArtSQE at DataArt
Let’s talk about
Aleksandr Tkalenko
JS developer
DataArt Dnepropetrovsk
Dnepropetrovsk 2015
1
JS modules
2
- encapsulation
- organization
JS modules PURPOSES
3
- encapsulation
- organization
JS modules PURPOSES
● no global scope pollution
● different library versions use
● security
4
- encapsulation
- organization
JS modules PURPOSES
● convenient using
● decoupling
● re-use / DRY principle
5
- global variables / namespace / tag
- AMD
- AMD with CommonJS
- CommonJS
WAYS TO DEFINE MODULES
6
- global variables
- AMD
- AMD with CommonJS
- CommonJS
WAYS TO DEFINE MODULES
7
- global variables
- AMD
- AMD with CommonJS
- CommonJS
WAYS TO DEFINE MODULES
8
- global variables
- AMD
- AMD with CommonJS
- CommonJS
WAYS TO DEFINE MODULES
9
- global variables
- AMD
- AMD with CommonJS
- CommonJS
WAYS TO DEFINE MODULES
- ES6 Modules
10
JS MODULE TOOLS
- RequireJS
- Browserify
- wreq
- curl
- jspm
11
WEBPACK
module bundler
12
installation and use
Installs as a npm package
Could be runned from CLI
… or as NodeJS package from
script
WEBPACK
13
- PLUGINS
WEBPACK
- DEV TOOLS
provides
- CODE SPLITTING
- LOADERS
14
code splitting WEBPACK
+ get only what you need
- many requests => much overhead
- request latency
+ one request, less latency
- get all bunch
REQUEST PER MODULE ALL IN ONE REQUEST
to organize modules as chunks
15
WEBPACK
+ get only what you need
+ less requests, less overhead
MODULES TO CHUNKS
code splittingto organize modules as chunks
16
WEBPACK
Defining splitting point
code splittingto organize modules as chunks
17
WEBPACK
PNG
PNG
less
CSS
sass
jade
hbs
haml
woff
ttf
eofJS
JSX
coffee
what parts modern webapp consists of?
JS
HTML
PNG
CSS
loadersto treat any static asset as a module
18
WEBPACKloadersto treat any static asset as a module
19
WEBPACKloadersto treat any static asset as a module
20
WEBPACKloadersto treat any static asset as a module
… and to run tests
21
WEBPACK
list of loaders
loadersto treat any static asset as a module
60+
22
rich plugin system WEBPACK
to get inside the process
wanna some
dependency injection
bower modules
uglified javascript with sourceMaps
?smart chunks loading
23
24
rich plugin system WEBPACK
to get inside the process
PLUGINS!
25
rich plugin system WEBPACK
to get inside the process
26
rich plugin system WEBPACK
to get inside the process
27
rich plugin system WEBPACK
to get inside the process
28
rich plugin system WEBPACK
to get inside the process
29
rich plugin system WEBPACK
to get inside the process
smart common chunks extraction
p1.entry.chunk.js
p2.entry.chunk.js
p3.entry.chunk.js
common.chunk.js
30
rich plugin system WEBPACK
to get inside the process
list of plugins
20+
31
dev tools and other stuff WEBPACK
to make work fun and easy
- DEV SERVER
- HOT MODULE REPLACEMENT
- DEPENDENCIES VISUALIZATION
32
dev tools and other stuff WEBPACK
to make work fun and easy
33
COMPARISON
feature WEBPACK RequireJS Browserify
CommonJS yes wrapping in yes
AMD yes yes no
Chunks on demand yes yes no
expressions in require
yes no no
Runtime overhead
243b + 20b per module + 4b
per dependency
14.7kb + 0b per module + (3b +
X) per dependency
415b + 25b per module +
(6b + 2X) per dependency
34
Q/A
???
“ Let’s talk about Webpack ”
Aleksandr Tkalenko
DataArt Dnepropetrovsk
2015
35
1 of 35

More Related Content

What's hot(20)

Webpack slidesWebpack slides
Webpack slides
Андрей Вандакуров4.7K views
Webpack IntroductionWebpack Introduction
Webpack Introduction
Anjali Chawla2.1K views
Webpack: from 0 to 2Webpack: from 0 to 2
Webpack: from 0 to 2
Alessandro Bellini282 views
Bundle your modules with WebpackBundle your modules with Webpack
Bundle your modules with Webpack
Jake Peyser447 views
Lecture: Webpack 4Lecture: Webpack 4
Lecture: Webpack 4
Sergei Iastrebov216 views
WebpackWebpack
Webpack
Raymond McDermott224 views
#2 Hanoi Magento Meetup - Part 2: Knockout JS#2 Hanoi Magento Meetup - Part 2: Knockout JS
#2 Hanoi Magento Meetup - Part 2: Knockout JS
Hanoi MagentoMeetup480 views
Angular2 ecosystemAngular2 ecosystem
Angular2 ecosystem
Kamil Lelonek9.3K views
Webpack and Web Performance OptimizationWebpack and Web Performance Optimization
Webpack and Web Performance Optimization
Chen-Tien Tsai1.5K views
Nuxt.js - IntroductionNuxt.js - Introduction
Nuxt.js - Introduction
Sébastien Chopin4.5K views
Nuxt TalkNuxt Talk
Nuxt Talk
Sébastien Chopin1.1K views
System webpack-jspmSystem webpack-jspm
System webpack-jspm
Jesse Warden9.2K views
DotNet MVC and webpack + Babel + reactDotNet MVC and webpack + Babel + react
DotNet MVC and webpack + Babel + react
Chen-Tien Tsai2.7K views
Bower & Grunt - A practical workflowBower & Grunt - A practical workflow
Bower & Grunt - A practical workflow
Riccardo Coppola5.8K views
Grunt and BowerGrunt and Bower
Grunt and Bower
George Estebe1.2K views
Front-end build tools - WebpackFront-end build tools - Webpack
Front-end build tools - Webpack
Razvan Rosu167 views

Similar to Webpack (20)

More from DataArt(20)

About DataArt HR PartnersAbout DataArt HR Partners
About DataArt HR Partners
DataArt306 views
Event management в ITEvent management в IT
Event management в IT
DataArt286 views
Communication in QA's lifeCommunication in QA's life
Communication in QA's life
DataArt158 views
DevOps in real lifeDevOps in real life
DevOps in real life
DataArt157 views
SelenoidSelenoid
Selenoid
DataArt1.7K views
SelenideSelenide
Selenide
DataArt547 views

Webpack