SlideShare una empresa de Scribd logo
1 de 63
Webpack and Web
Performance Optimization
Blackie.Tsai
Blackie.tsai@xuenn.com
2016/11/18
Agenda
• Webpack Introduction
• Web Optimization
• Modularized Javascript and React
• Collaborate with .net MVC
Webpack Introduction
• Today’s Web Apps Trendy
• More and more JavaScript is being used.
• Modern browsers are offering a wider range of interfaces.
• Fewer full page reloads → even more code in a page
• As a result there is a lot of code on the client side! A big code base
needs to be organized. Module systems offer the option to split your
code base into modules
Current problems
Webpack - A Module Bundler
• A bundler for javascript and friends. Packs many modules into a few
bundled assets. Code Splitting allows to load parts for the
application on demand. Through "loaders," modules can be
CommonJs, AMD, ES6 modules, CSS, Images, JSON, Coffeescript,
LESS, ... and your custom stuff. https://webpack.github.io
• Usage: https://webpack.github.io/docs/tutorials/getting-started/
Goals
• Split the dependency tree into chunks loaded on demand
• Keep initial loading time low
• Every static asset should be able to be a module
• Ability to integrate 3rd-party libraries as modules
• Ability to customize nearly every part of the module bundler
• Suited for big projects
Features
• Code Splitting
• allows you to split your codebase into multiple chunks. Chunks are loaded asynchronously at
runtime. This reduces the initial loading time.
• Optimizations
• can do many optimizations to reduce the output size of your JavaScript by de-duplicating
frequently used modules, minifying, and giving you full control of what is loaded initially and
what is loaded at runtime through code splitting.
• Loaders
• enables use of loaders to preprocess files. This allows you to bundle any static resource way
beyond JavaScript. You can easily write your own loaders using node.js.
• Module Format (AMD/CommonJS)
• supports both AMD and CommonJS module styles.
• Plug-in System
• webpack features a rich plugin system and allows you to customize
Webpack flow
Loader
• Loaders allow you to preprocess files as you require() or “load”
them.
• Loaders are kind of like “tasks” in other build tools, and provide
a powerful way to handle frontend build steps.
• Loaders can transform files from a different language like,
CoffeeScript to JavaScript, or inline images as data URLs.
• Loaders even allow you to do things like require() css files right in
your JavaScript! You can import other Loaders to help you.
• E.g. CSS-LOADER, IMAGE LOADER, BUNDLE-LOADER
Loader - Sample
• Webpack transform a module with a loader
• ! syntax separating the loader from the module path? Loaders, like modules
can also be specified with a relative path (as if you were requiring it) instead
of the loader name
• Chained together by separating loaders with the !
• Loaders with Parameters
• loaders by config
var moduleWithOneLoader = require("my-loader!./my-awesome-module");
var moduleWithLoaders = require("style-loader!css-loader!less-loader!./my-styles.less");
var moduleWithLoaderHasParameters = require("loader?with=parameter!./file");
{
module: {
loaders: [ { test: /.coffee$/, loader: "coffee-loader" } ],
preLoaders: [ { test: /.coffee$/, loader: "coffee-hint-loader" } ] }
};
Webpack Config File
• entry
• Setup entry file
• output
• Determine output path and file name
• module(optional)
• Setup loaders
Environment Setup
NodeJS
• Node.js® is a JavaScript runtime built on Chrome's V8 JavaScript
engine. Node.js uses an event-driven, non-blocking I/O model that
makes it lightweight and efficient.
• Node.js' package ecosystem, npm, is the largest ecosystem of open
source libraries in the world.
• https://nodejs.org/dist/v4.5.0/node-v4.5.0-x64.msi
• https://nodejs.org/dist/v6.6.0/node-v6.6.0-x64.msi
[NPM]Webpack
• https://www.npmjs.com/package/webpack
• Setup
• Project: npm install webpack --save-dev
• Global: npm install webpack –g
• Common Commands(usually execute with webpack.config.js file)
• webpack:execute one time in dev mode. E.g. webpack main.js bundle.js
• webpack -p: execute for production-ready
• webpack --watch:execute and watch change to execute on background
• webpack --progress --colors: execute with progress bar and colors
[NPM]webpack-notifier
• https://www.npmjs.com/package/webpack-notifier
• npm install --save-dev webpack-notifier
WebPack Task Runner
• https://visualstudiogallery.msdn.microsoft.com/5497fd10-b1ba-
474c-8991-1438ae47012a
Webpack Tutorial
Welcome Webpack
• http://webpack.github.io/docs/tutorials/getting-started/
Web Optimization
• Unoptimized Resource(js, css, images)
• Sites impacted: 90%
• Content Served Without HTTP Compression
• Sites impacted: 72%
• Without Concatenate Resource(js, css or images) to one Request
• Sites impacted: 69%
• Too much HTTP Requests
• Sites impacted: 69%
• Without Caching Information
• Sites impacted: 65%
• Domain Sharding Not Implemented
• Sites impacted: 64%
Top issue for Web Performance
• Image Optimization
• Reduce HTTP Requests
• Minify CSS and Javascript
• Critical Path and Render Blocking Resources (CSS + JS)
• Reduce Latency with a CDN
• Avoid 301 Redirects
• Caching
• Web Font Performance
• Enable Gzip Compression
• Fix 404 Errors
• Serve Scaled Images
Top tips for Web Performance Optimization
Adaptive Web Concept
Header
HTML
iframe
img
media
• CSS, icon and fonts
• Most file can Concatenate
(CSS merge and image sprite )
• Loading first and sequence with blocking
• Body content, JS and other resource
• Bigger file size than Header
• Most file can’t Concatenate
(exclude JS bundle and image sprite )
• Loading/Executing later when read the content with non-blocking
body
Loading JavaScript Dynamically
Delaying Image Loading
• a.k.a Image Lazy Loading
Solution To Lazy Loading SEO Impact
Web Optimize Before Mobile Lite
• Now
• SBK have 15 requests for total 500KB transferred
• 188 have 8 requests for total 600KB transferred
• Action
• Eliminate render-blocking JavaScript and CSS in above-the-fold content
• Less request
• Can improve 40% for latency issue on too many requests, from 23 to 14
• SBK
• Combine JS request
• 188(Brand)
• Combine JS request
• Refine 188(Brand) header/footer for provide less request version for
SBK
Reduce less with low User impact
• Changes
• General
• No image(jpg, png and gif) file
• Use CSS, Font(include icon) and HTML
• Only one kind of font for Mobile Lite(Only Lato-Regular, no Lato-Bold)
• Pagination for Today
• Homepage
• No image on each feature event
• All Market
• Score Board with simple background color
• Estimated improvement
• Reduce 4 request
• Reduce 180 KB
Reduce more but high User impact
• Changes
• General
• No Auto refresh, using manually refresh(e.g. can click every 30s)
• All Market
• No Live Center(5 sec auto-refresh with 2.5 KB=>1 min with 30KB)
• Estimated improvement
• Reduce 1 request
• Reduce 20 KB(exclude Live Center)
Cut function but Company impact
• Changes
• Homepage
• Only display 1st feature event
• Only display top N priority sports events
• Main Odds
• Only display top N priority competition event
• All Market
• Display predefine priority markets only
• Estimated improvement
• Reduce 50 KB
Comparison
Original Web Optimized Low User Impact High User Impact Company Impact
Request 23 14 10 9 9
Transferred size(KB) 1, 100 1,100 920 930 880
Play with Gulp
Gulp
Gulp is a Task Runner build by JavaScript to
help automation. The less work you have to
do when performing repetitive tasks like
minification, compilation, unit testing,
linting, etc. After you've configured it
through a Gulpfile, a task runner can do
most of that mundane work for team
•Minify JavaScript, CSS files
•Combine JavaScript, CSS files(including
compile Sass and Less) and Image
Sprites
•Testing
•Format or Code Rule check
Development Flow - Developing
• Integrate with Visual Studio with Task Runner Explorer, Gulp for VS
• Help doing below task when ITC doing developing
• Concatenation and minifying
• Compile SASS file to CSS file on runtime
• Testing minify JavaScript, CSS files
• Testing combine JavaScript, CSS files(Sass and Less) and Image Sprites
• Validate front-end coding rule
Gulp Plugin
• gulp-concat:file concatenate
• gulp-minify-css: CSS minifying
• gulp-uglify: Compressed Javascript(Can replace by Webpack)
• gulp-rename:File rename
• gulp-html-replace :Replace target source path
• gulp-minify-html : Compressed HTML
• Ref
• http://www.oxxostudio.tw/articles/201503/gulp-2-compress-js-css.html
• http://www.oxxostudio.tw/articles/201503/gulp-3-compress-html.html
Integrate with Webpack
• With webpack-stream (not recommened)
• https://github.com/shama/webpack-stream
• Run webpack as a stream to conveniently integrate with gulp.
• Big issue=>gulp & webpack整合,鱼与熊掌我都要!
• Without webpack-stream
• https://webpack.github.io/docs/usage-with-gulp.html
var gulp = require("gulp");
var gutil = require("gulp-util");
var webpack = require("webpack");
var WebpackDevServer = require("webpack-dev-server");
gulp.task("webpack", function(callback) {
// run webpack
webpack({
// configuration
}, function(err, stats) {
if(err) throw new gutil.PluginError("webpack", err);
gutil.log("[webpack]", stats.toString({
// output options
}));
callback();
});
});
Development Flow – Build and Release
• Gulp help doing below task
• Compile SASS file to CSS file
• Minify JavaScript, CSS, HTML files(Release version)
• Concatenate JavaScript, CSS files(including compile Sass and Less) and Image
Sprites(Release version)
• [Optional]Generate Format or Code Rule report
• [Optional]Generate Front-end test report
• Jenkins help doing below task
• Trigger Grunt to build Release version
• Build and Release DEV(daily)
• Validate Unit test
• Validate Integration test
• Validate Automation test(Selenium)
• Validate Web performance test(YSlow, Phantomjs or etc…)
• Build and Release QAT
• Prepare UAT release package
• Aggregate and Sent release report
• General
• Avoid 301 Redirects
• Fix All 404 Errors
• Loading Resources On-demand
• Avoid Render Blocking
• Static content optimize
• Concatenate(CSS merge、JS bundle、image sprite )
• Compression(gzip、minify, image compression)
• Request optimize
• CDN
• Front-end Cache
• Request Tuning and Combine
• Domain Sharding
Web Optimize
Modularized JavaScript
and React
Modularized JavaScript
• Pros
• Encapsulation
• Decoupling
• Organization
• No global scope pollution
• Security
• Re-use
• Cons
• More difficult to release
• Complex dependency
Thinking in React
ReactJS+Webpack Structure
Babel Introdcution
Babel - A Tool to convert ES6 to ES5
• A Tool to convert ES6 to ES5
• Babel is the most popular tool used to convert ES6 to ES5. It has
various interfaces like a CLI, Node-module and also an online
converter. I use the node module for my apps and use theonline
version to quickly see the differences.
• Why ES6
• 5 JavaScript “Bad” Parts That Are Fixed In ES6
• Modularized for React, Babel can convert JSX syntax and strip out type
annotations.
Webpack+Babel+React
Grunt/Gulp for React
• Not all browsers are supporting ES6 yet, so we're going to have to
transpile our ES6 code, turning it into ES5. We're also going to have
to handle 'JSX', the special Javascript that we can use for React. We
also need to play well with existing code.
Webpack for React
• Webpack is a bundler. It'll take a bunch of loose Javascript files and
build a single file from the lot
Webpack+Babel for React
• Even better, we can configure webpack to run files that match a
certain pattern to go through other 'loaders', which can process the
files further.
• We can use the Babel transpiler to turn an ES6 file to ES5. We just
need the glue to let Webpack use Babel as a loader. That comes in
the form of the Babel Loader:
Babel-loader
• This package allows transpiling JavaScript files using Babel and
webpack. https://github.com/babel/babel-loader
Dependency
• React uses JSX as the XML-like syntax extension over JavaScript to
specify component tree structure, data flow, and event handlers. JSX
is processed by Webpack module bundler using specific loaders or
convertors.
Environment Setup
Visual Studio 2015 with latest update
• https://blogs.msdn.microsoft.com/visualstudio/2015/06/10/javas
cript-editor-improvements-in-visual-studio-2015/
• https://www.visualstudio.com/en-us/news/vs2015-update1-
vs.aspx
• React's JSX is now natively supported
• ECMAScript 2015 (formerly ECMAScript 6) support
React Snippet Pack
• https://visualstudiogallery.msdn.microsoft.com/234d79e9-f0fd-
41e1-a926-850da8e8c7d7
Collaborate with .net
MVC
• Demo Download
• Original post : detail of how to setup up front-end in asp.net core
and MVC5, sample is clone from AspNetReactSamples
• Setup
• Install node and NPM
• Go to root directory and use NPM to install js dependency
• npm install
• Build with install nuget dependency
• Run App
Demo
Project Structure
package.json
Layout and View
ES6 to ES5(using Babel)
Advance Webpack
Reference
• 設定開發React的環境
• 設定開發React的環境 - React Hot Loader
• Production optimization with React and Webpack
Q & A
11F., No.399, Ruiguang Rd., Neihu Dist., Taipei City 114, Taiwan
TEL: +886 2 2798 8529 Fax: +886 2 2798 8531 Website : www.xuenn.com
THANK YOU!
Reference
• WEBPACK入門教學筆記
• 18 Tips for Website Performance Optimization
• Performance Guide for Tizen Web Applications(1): Resource Loading
• How-To: Integrate Webpack into Visual Studio 2015
• webpack-howto
• Pro React : Appendix A: Webpack for React
• 如何使用 Webpack 模組整合工具
• Webpack: your final module bundler
• Getting Started with React & ES6
• React Speed Coding
• Parallel Downloads Across Domains
• dependencies are installed on both:
• npm install from a directory that contains package.json
• npm install $package on any other directory
• devDependencies are:
• also installed on npm install on a directory that contains package.json, unless
you pass the --production flag
• not installed on npm install "$package" on any other directory, unless you
give it the --dev option.
• are not installed transitively.
• Most important
• dependencies are required to run, devDependencies only to develop, e.g.:
unit tests, Coffeescript to Javascript transpilation, minification, ...
[NPM] dependencies and devDependencies

Más contenido relacionado

La actualidad más candente

Webpack Introduction
Webpack IntroductionWebpack Introduction
Webpack IntroductionAnjali Chawla
 
Webpack: your final module bundler
Webpack: your final module bundlerWebpack: your final module bundler
Webpack: your final module bundlerAndrea Giannantonio
 
Here Be Dragons - Debugging WordPress
Here Be Dragons - Debugging WordPressHere Be Dragons - Debugging WordPress
Here Be Dragons - Debugging WordPressRami Sayar
 
Introduction of webpack 4
Introduction of webpack 4Introduction of webpack 4
Introduction of webpack 4Vijay Shukla
 
Webpack
Webpack Webpack
Webpack DataArt
 
WordPress development checklist
WordPress development checklistWordPress development checklist
WordPress development checklistBinh Quan Duc
 
002. Working with Webpack
002. Working with Webpack002. Working with Webpack
002. Working with WebpackBinh Quan Duc
 
Drupal, Android and iPhone
Drupal, Android and iPhoneDrupal, Android and iPhone
Drupal, Android and iPhoneAlexandru Badiu
 
In-browser storage and me
In-browser storage and meIn-browser storage and me
In-browser storage and meJason Casden
 
Front-end build tools - Webpack
Front-end build tools - WebpackFront-end build tools - Webpack
Front-end build tools - WebpackRazvan Rosu
 
Webpack Tutorial, Uppsala JS
Webpack Tutorial, Uppsala JSWebpack Tutorial, Uppsala JS
Webpack Tutorial, Uppsala JSEmil Öberg
 
Node.js & Twitter Bootstrap Crash Course
Node.js & Twitter Bootstrap Crash CourseNode.js & Twitter Bootstrap Crash Course
Node.js & Twitter Bootstrap Crash CourseAaron Silverman
 
Bower & Grunt - A practical workflow
Bower & Grunt - A practical workflowBower & Grunt - A practical workflow
Bower & Grunt - A practical workflowRiccardo Coppola
 
PHP Indonesia - Nodejs Web Development
PHP Indonesia - Nodejs Web DevelopmentPHP Indonesia - Nodejs Web Development
PHP Indonesia - Nodejs Web DevelopmentIrfan Maulana
 

La actualidad más candente (20)

Lecture: Webpack 4
Lecture: Webpack 4Lecture: Webpack 4
Lecture: Webpack 4
 
Webpack Introduction
Webpack IntroductionWebpack Introduction
Webpack Introduction
 
Webpack: your final module bundler
Webpack: your final module bundlerWebpack: your final module bundler
Webpack: your final module bundler
 
Webpack
WebpackWebpack
Webpack
 
Webpack: from 0 to 2
Webpack: from 0 to 2Webpack: from 0 to 2
Webpack: from 0 to 2
 
An Intro into webpack
An Intro into webpackAn Intro into webpack
An Intro into webpack
 
Here Be Dragons - Debugging WordPress
Here Be Dragons - Debugging WordPressHere Be Dragons - Debugging WordPress
Here Be Dragons - Debugging WordPress
 
Introduction of webpack 4
Introduction of webpack 4Introduction of webpack 4
Introduction of webpack 4
 
Webpack
Webpack Webpack
Webpack
 
WordPress development checklist
WordPress development checklistWordPress development checklist
WordPress development checklist
 
Webpack DevTalk
Webpack DevTalkWebpack DevTalk
Webpack DevTalk
 
002. Working with Webpack
002. Working with Webpack002. Working with Webpack
002. Working with Webpack
 
Drupal, Android and iPhone
Drupal, Android and iPhoneDrupal, Android and iPhone
Drupal, Android and iPhone
 
In-browser storage and me
In-browser storage and meIn-browser storage and me
In-browser storage and me
 
Front-end build tools - Webpack
Front-end build tools - WebpackFront-end build tools - Webpack
Front-end build tools - Webpack
 
Webpack Tutorial, Uppsala JS
Webpack Tutorial, Uppsala JSWebpack Tutorial, Uppsala JS
Webpack Tutorial, Uppsala JS
 
Node.js & Twitter Bootstrap Crash Course
Node.js & Twitter Bootstrap Crash CourseNode.js & Twitter Bootstrap Crash Course
Node.js & Twitter Bootstrap Crash Course
 
Bower & Grunt - A practical workflow
Bower & Grunt - A practical workflowBower & Grunt - A practical workflow
Bower & Grunt - A practical workflow
 
PHP Indonesia - Nodejs Web Development
PHP Indonesia - Nodejs Web DevelopmentPHP Indonesia - Nodejs Web Development
PHP Indonesia - Nodejs Web Development
 
An Overview on Nuxt.js
An Overview on Nuxt.jsAn Overview on Nuxt.js
An Overview on Nuxt.js
 

Destacado

Website Auto scraping with Autoit and .Net HttpRequest
Website Auto scraping with Autoit and .Net HttpRequestWebsite Auto scraping with Autoit and .Net HttpRequest
Website Auto scraping with Autoit and .Net HttpRequestChen-Tien Tsai
 
webpack 入門
webpack 入門webpack 入門
webpack 入門Anna Su
 
Warsaw Frontend Meetup #1 - Webpack
Warsaw Frontend Meetup #1 - WebpackWarsaw Frontend Meetup #1 - Webpack
Warsaw Frontend Meetup #1 - WebpackRadosław Rosłaniec
 
Ramda, a functional JavaScript library
Ramda, a functional JavaScript libraryRamda, a functional JavaScript library
Ramda, a functional JavaScript libraryDerek Willian Stavis
 
Packing it all: JavaScript module bundling from 2000 to now
Packing it all: JavaScript module bundling from 2000 to nowPacking it all: JavaScript module bundling from 2000 to now
Packing it all: JavaScript module bundling from 2000 to nowDerek Willian Stavis
 
La Persona Ante El Cosmos I
La Persona Ante El Cosmos ILa Persona Ante El Cosmos I
La Persona Ante El Cosmos Izarasala
 
Reducing IT Complexity to Accelerate Digital Business
Reducing IT Complexity to Accelerate Digital BusinessReducing IT Complexity to Accelerate Digital Business
Reducing IT Complexity to Accelerate Digital BusinessCognizant
 
Comunicación para el éxito. Taller de Oratoria 2014 con @Matytchey y @AvanzaSf
Comunicación para el éxito. Taller de Oratoria 2014 con @Matytchey y @AvanzaSfComunicación para el éxito. Taller de Oratoria 2014 con @Matytchey y @AvanzaSf
Comunicación para el éxito. Taller de Oratoria 2014 con @Matytchey y @AvanzaSfAvanzaSf
 
Practical Contract Law Understanding & Drafting Contracts for Non-Lawyers
Practical Contract Law Understanding & Drafting Contracts for Non-LawyersPractical Contract Law Understanding & Drafting Contracts for Non-Lawyers
Practical Contract Law Understanding & Drafting Contracts for Non-Lawyersrockporshe
 

Destacado (19)

Website Auto scraping with Autoit and .Net HttpRequest
Website Auto scraping with Autoit and .Net HttpRequestWebsite Auto scraping with Autoit and .Net HttpRequest
Website Auto scraping with Autoit and .Net HttpRequest
 
webpack 入門
webpack 入門webpack 入門
webpack 入門
 
Advanced webpack
Advanced webpackAdvanced webpack
Advanced webpack
 
Warsaw Frontend Meetup #1 - Webpack
Warsaw Frontend Meetup #1 - WebpackWarsaw Frontend Meetup #1 - Webpack
Warsaw Frontend Meetup #1 - Webpack
 
Ramda, a functional JavaScript library
Ramda, a functional JavaScript libraryRamda, a functional JavaScript library
Ramda, a functional JavaScript library
 
Packing it all: JavaScript module bundling from 2000 to now
Packing it all: JavaScript module bundling from 2000 to nowPacking it all: JavaScript module bundling from 2000 to now
Packing it all: JavaScript module bundling from 2000 to now
 
Firmablogging - hvorfor
Firmablogging - hvorforFirmablogging - hvorfor
Firmablogging - hvorfor
 
La Persona Ante El Cosmos I
La Persona Ante El Cosmos ILa Persona Ante El Cosmos I
La Persona Ante El Cosmos I
 
LBC newsletter issue 11
LBC newsletter issue 11LBC newsletter issue 11
LBC newsletter issue 11
 
Mobile only by google Breaking Mobile 2015
Mobile only by google Breaking Mobile 2015Mobile only by google Breaking Mobile 2015
Mobile only by google Breaking Mobile 2015
 
Presentación ympacto+
Presentación ympacto+Presentación ympacto+
Presentación ympacto+
 
Reducing IT Complexity to Accelerate Digital Business
Reducing IT Complexity to Accelerate Digital BusinessReducing IT Complexity to Accelerate Digital Business
Reducing IT Complexity to Accelerate Digital Business
 
CONECTATE 105: VEJEZ, CIELO
CONECTATE 105: VEJEZ, CIELOCONECTATE 105: VEJEZ, CIELO
CONECTATE 105: VEJEZ, CIELO
 
Node-webkit
Node-webkitNode-webkit
Node-webkit
 
About us
About usAbout us
About us
 
Comunicación para el éxito. Taller de Oratoria 2014 con @Matytchey y @AvanzaSf
Comunicación para el éxito. Taller de Oratoria 2014 con @Matytchey y @AvanzaSfComunicación para el éxito. Taller de Oratoria 2014 con @Matytchey y @AvanzaSf
Comunicación para el éxito. Taller de Oratoria 2014 con @Matytchey y @AvanzaSf
 
El Mensajero Del Sol 70 1
El  Mensajero Del  Sol 70 1El  Mensajero Del  Sol 70 1
El Mensajero Del Sol 70 1
 
Ri casipe bajo
Ri casipe bajoRi casipe bajo
Ri casipe bajo
 
Practical Contract Law Understanding & Drafting Contracts for Non-Lawyers
Practical Contract Law Understanding & Drafting Contracts for Non-LawyersPractical Contract Law Understanding & Drafting Contracts for Non-Lawyers
Practical Contract Law Understanding & Drafting Contracts for Non-Lawyers
 

Similar a Webpack and Web Performance Optimization

DrupalSouth 2015 - Performance: Not an Afterthought
DrupalSouth 2015 - Performance: Not an AfterthoughtDrupalSouth 2015 - Performance: Not an Afterthought
DrupalSouth 2015 - Performance: Not an AfterthoughtNick Santamaria
 
Java script nirvana in netbeans [con5679]
Java script nirvana in netbeans [con5679]Java script nirvana in netbeans [con5679]
Java script nirvana in netbeans [con5679]Ryan Cuprak
 
Building the next generation of themes with WP Rig 2.0
Building the next generation of themes with WP Rig 2.0Building the next generation of themes with WP Rig 2.0
Building the next generation of themes with WP Rig 2.0Morten Rand-Hendriksen
 
Shift Remote: JS - Javascript Build Tools: Past & Beyond - Shedrack Akintayo
Shift Remote: JS - Javascript Build Tools: Past & Beyond - Shedrack Akintayo Shift Remote: JS - Javascript Build Tools: Past & Beyond - Shedrack Akintayo
Shift Remote: JS - Javascript Build Tools: Past & Beyond - Shedrack Akintayo Shift Conference
 
Masterin Large Scale Java Script Applications
Masterin Large Scale Java Script ApplicationsMasterin Large Scale Java Script Applications
Masterin Large Scale Java Script ApplicationsFabian Jakobs
 
Building a website without a webserver on Azure
Building a website without a webserver on AzureBuilding a website without a webserver on Azure
Building a website without a webserver on AzureTodd Whitehead
 
Website optimization with request reduce
Website optimization with request reduceWebsite optimization with request reduce
Website optimization with request reduceMatt Wrock
 
Front-End Frameworks: a quick overview
Front-End Frameworks: a quick overviewFront-End Frameworks: a quick overview
Front-End Frameworks: a quick overviewDiacode
 
Improve your web dev workflow in Visual Studio
Improve your web dev workflow in Visual StudioImprove your web dev workflow in Visual Studio
Improve your web dev workflow in Visual StudioDavid Paquette
 
ASP.NET Scalability - DDD7
ASP.NET Scalability - DDD7ASP.NET Scalability - DDD7
ASP.NET Scalability - DDD7Phil Pursglove
 
Drupal: an Overview
Drupal: an OverviewDrupal: an Overview
Drupal: an OverviewMatt Weaver
 
Asp.Net 3 5 Part 1
Asp.Net 3 5 Part 1Asp.Net 3 5 Part 1
Asp.Net 3 5 Part 1asim78
 
Static Site Generation with Hugo and Markdown
Static Site Generation with Hugo and MarkdownStatic Site Generation with Hugo and Markdown
Static Site Generation with Hugo and MarkdownNic Raboy
 
ASP.NET Scalability - VBUG London
ASP.NET Scalability - VBUG LondonASP.NET Scalability - VBUG London
ASP.NET Scalability - VBUG LondonPhil Pursglove
 
Static Site Generators - Developing Websites in Low-resource Condition
Static Site Generators - Developing Websites in Low-resource ConditionStatic Site Generators - Developing Websites in Low-resource Condition
Static Site Generators - Developing Websites in Low-resource ConditionIWMW
 
Enterprise WordPress - Performance, Scalability and Redundancy
Enterprise WordPress - Performance, Scalability and RedundancyEnterprise WordPress - Performance, Scalability and Redundancy
Enterprise WordPress - Performance, Scalability and RedundancyJohn Giaconia
 
Back to the 90s' - Revenge of the static website
Back to the 90s' - Revenge of the static websiteBack to the 90s' - Revenge of the static website
Back to the 90s' - Revenge of the static websiteYves Goeleven
 

Similar a Webpack and Web Performance Optimization (20)

DrupalSouth 2015 - Performance: Not an Afterthought
DrupalSouth 2015 - Performance: Not an AfterthoughtDrupalSouth 2015 - Performance: Not an Afterthought
DrupalSouth 2015 - Performance: Not an Afterthought
 
Java script nirvana in netbeans [con5679]
Java script nirvana in netbeans [con5679]Java script nirvana in netbeans [con5679]
Java script nirvana in netbeans [con5679]
 
Building the next generation of themes with WP Rig 2.0
Building the next generation of themes with WP Rig 2.0Building the next generation of themes with WP Rig 2.0
Building the next generation of themes with WP Rig 2.0
 
Shift Remote: JS - Javascript Build Tools: Past & Beyond - Shedrack Akintayo
Shift Remote: JS - Javascript Build Tools: Past & Beyond - Shedrack Akintayo Shift Remote: JS - Javascript Build Tools: Past & Beyond - Shedrack Akintayo
Shift Remote: JS - Javascript Build Tools: Past & Beyond - Shedrack Akintayo
 
Building JavaScript
Building JavaScriptBuilding JavaScript
Building JavaScript
 
Masterin Large Scale Java Script Applications
Masterin Large Scale Java Script ApplicationsMasterin Large Scale Java Script Applications
Masterin Large Scale Java Script Applications
 
Building a website without a webserver on Azure
Building a website without a webserver on AzureBuilding a website without a webserver on Azure
Building a website without a webserver on Azure
 
Website optimization with request reduce
Website optimization with request reduceWebsite optimization with request reduce
Website optimization with request reduce
 
Front-End Frameworks: a quick overview
Front-End Frameworks: a quick overviewFront-End Frameworks: a quick overview
Front-End Frameworks: a quick overview
 
Improve your web dev workflow in Visual Studio
Improve your web dev workflow in Visual StudioImprove your web dev workflow in Visual Studio
Improve your web dev workflow in Visual Studio
 
ASP.NET Scalability - DDD7
ASP.NET Scalability - DDD7ASP.NET Scalability - DDD7
ASP.NET Scalability - DDD7
 
Drupal: an Overview
Drupal: an OverviewDrupal: an Overview
Drupal: an Overview
 
Asp.Net 3 5 Part 1
Asp.Net 3 5 Part 1Asp.Net 3 5 Part 1
Asp.Net 3 5 Part 1
 
Static Site Generation with Hugo and Markdown
Static Site Generation with Hugo and MarkdownStatic Site Generation with Hugo and Markdown
Static Site Generation with Hugo and Markdown
 
ASP.NET Scalability - VBUG London
ASP.NET Scalability - VBUG LondonASP.NET Scalability - VBUG London
ASP.NET Scalability - VBUG London
 
Static Site Generators - Developing Websites in Low-resource Condition
Static Site Generators - Developing Websites in Low-resource ConditionStatic Site Generators - Developing Websites in Low-resource Condition
Static Site Generators - Developing Websites in Low-resource Condition
 
Short-Training asp.net vNext
Short-Training asp.net vNextShort-Training asp.net vNext
Short-Training asp.net vNext
 
Enterprise WordPress - Performance, Scalability and Redundancy
Enterprise WordPress - Performance, Scalability and RedundancyEnterprise WordPress - Performance, Scalability and Redundancy
Enterprise WordPress - Performance, Scalability and Redundancy
 
performance.ppt
performance.pptperformance.ppt
performance.ppt
 
Back to the 90s' - Revenge of the static website
Back to the 90s' - Revenge of the static websiteBack to the 90s' - Revenge of the static website
Back to the 90s' - Revenge of the static website
 

Más de Chen-Tien Tsai

關於軟體工程師職涯的那些事
關於軟體工程師職涯的那些事關於軟體工程師職涯的那些事
關於軟體工程師職涯的那些事Chen-Tien Tsai
 
Artifacts management with CI and CD
Artifacts management with CI and CDArtifacts management with CI and CD
Artifacts management with CI and CDChen-Tien Tsai
 
.NET Security Application/Web Development - Part IV
.NET Security Application/Web Development - Part IV.NET Security Application/Web Development - Part IV
.NET Security Application/Web Development - Part IVChen-Tien Tsai
 
.NET Security Application/Web Development - Part III
.NET Security Application/Web Development - Part III.NET Security Application/Web Development - Part III
.NET Security Application/Web Development - Part IIIChen-Tien Tsai
 
.NET Security Application/Web Development - Part II
.NET Security Application/Web Development - Part II.NET Security Application/Web Development - Part II
.NET Security Application/Web Development - Part IIChen-Tien Tsai
 
.NET Security Application/Web Development - Part I
.NET Security Application/Web Development - Part I.NET Security Application/Web Development - Part I
.NET Security Application/Web Development - Part IChen-Tien Tsai
 
.NET Security Application/Web Development - Overview
.NET Security Application/Web Development - Overview.NET Security Application/Web Development - Overview
.NET Security Application/Web Development - OverviewChen-Tien Tsai
 
Designing distributedsystems cht6
Designing distributedsystems cht6Designing distributedsystems cht6
Designing distributedsystems cht6Chen-Tien Tsai
 
Reactive application with akka.NET & .NET Core
Reactive application with akka.NET & .NET CoreReactive application with akka.NET & .NET Core
Reactive application with akka.NET & .NET CoreChen-Tien Tsai
 
The Cloud - What's different
The Cloud - What's differentThe Cloud - What's different
The Cloud - What's differentChen-Tien Tsai
 
How to be a professional speaker
How to be a professional speakerHow to be a professional speaker
How to be a professional speakerChen-Tien Tsai
 
響應式程式開發之 .NET Core 應用 
響應式程式開發之 .NET Core 應用 響應式程式開發之 .NET Core 應用 
響應式程式開發之 .NET Core 應用 Chen-Tien Tsai
 
Artifacts management with DevOps
Artifacts management with DevOpsArtifacts management with DevOps
Artifacts management with DevOpsChen-Tien Tsai
 
Web optimization with service woker
Web optimization with service wokerWeb optimization with service woker
Web optimization with service wokerChen-Tien Tsai
 
GCPUG.TW Meetup #25 - ASP.NET Core with GCP
GCPUG.TW Meetup #25 - ASP.NET Core with GCPGCPUG.TW Meetup #25 - ASP.NET Core with GCP
GCPUG.TW Meetup #25 - ASP.NET Core with GCPChen-Tien Tsai
 
.NET Study Group - ASP.NET Core with GCP
.NET Study Group - ASP.NET Core with GCP.NET Study Group - ASP.NET Core with GCP
.NET Study Group - ASP.NET Core with GCPChen-Tien Tsai
 
C# 2 to 5 short Introduction
C# 2 to 5 short IntroductionC# 2 to 5 short Introduction
C# 2 to 5 short IntroductionChen-Tien Tsai
 
DevOps for dummies study sharing - part II
DevOps for dummies study sharing - part IIDevOps for dummies study sharing - part II
DevOps for dummies study sharing - part IIChen-Tien Tsai
 

Más de Chen-Tien Tsai (20)

關於軟體工程師職涯的那些事
關於軟體工程師職涯的那些事關於軟體工程師職涯的那些事
關於軟體工程師職涯的那些事
 
Artifacts management with CI and CD
Artifacts management with CI and CDArtifacts management with CI and CD
Artifacts management with CI and CD
 
.NET Security Application/Web Development - Part IV
.NET Security Application/Web Development - Part IV.NET Security Application/Web Development - Part IV
.NET Security Application/Web Development - Part IV
 
.NET Security Application/Web Development - Part III
.NET Security Application/Web Development - Part III.NET Security Application/Web Development - Part III
.NET Security Application/Web Development - Part III
 
.NET Security Application/Web Development - Part II
.NET Security Application/Web Development - Part II.NET Security Application/Web Development - Part II
.NET Security Application/Web Development - Part II
 
.NET Security Application/Web Development - Part I
.NET Security Application/Web Development - Part I.NET Security Application/Web Development - Part I
.NET Security Application/Web Development - Part I
 
.NET Security Application/Web Development - Overview
.NET Security Application/Web Development - Overview.NET Security Application/Web Development - Overview
.NET Security Application/Web Development - Overview
 
Designing distributedsystems cht6
Designing distributedsystems cht6Designing distributedsystems cht6
Designing distributedsystems cht6
 
Reactive application with akka.NET & .NET Core
Reactive application with akka.NET & .NET CoreReactive application with akka.NET & .NET Core
Reactive application with akka.NET & .NET Core
 
The Cloud - What's different
The Cloud - What's differentThe Cloud - What's different
The Cloud - What's different
 
How to be a professional speaker
How to be a professional speakerHow to be a professional speaker
How to be a professional speaker
 
Agile tutorial
Agile tutorialAgile tutorial
Agile tutorial
 
響應式程式開發之 .NET Core 應用 
響應式程式開發之 .NET Core 應用 響應式程式開發之 .NET Core 應用 
響應式程式開發之 .NET Core 應用 
 
Artifacts management with DevOps
Artifacts management with DevOpsArtifacts management with DevOps
Artifacts management with DevOps
 
Web optimization with service woker
Web optimization with service wokerWeb optimization with service woker
Web optimization with service woker
 
GCPUG.TW Meetup #25 - ASP.NET Core with GCP
GCPUG.TW Meetup #25 - ASP.NET Core with GCPGCPUG.TW Meetup #25 - ASP.NET Core with GCP
GCPUG.TW Meetup #25 - ASP.NET Core with GCP
 
.NET Study Group - ASP.NET Core with GCP
.NET Study Group - ASP.NET Core with GCP.NET Study Group - ASP.NET Core with GCP
.NET Study Group - ASP.NET Core with GCP
 
C# 2 to 5 short Introduction
C# 2 to 5 short IntroductionC# 2 to 5 short Introduction
C# 2 to 5 short Introduction
 
Docker - fundamental
Docker  - fundamentalDocker  - fundamental
Docker - fundamental
 
DevOps for dummies study sharing - part II
DevOps for dummies study sharing - part IIDevOps for dummies study sharing - part II
DevOps for dummies study sharing - part II
 

Último

DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 AmsterdamDEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 AmsterdamUiPathCommunity
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native ApplicationsWSO2
 
ICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesrafiqahmad00786416
 
[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdfSandro Moreira
 
Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024The Digital Insurer
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024The Digital Insurer
 
CNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In PakistanCNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In Pakistandanishmna97
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...apidays
 
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...apidays
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FMESafe Software
 
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...Angeliki Cooney
 
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...apidays
 
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...Orbitshub
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...apidays
 
FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024The Digital Insurer
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoffsammart93
 
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Victor Rentea
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAndrey Devyatkin
 

Último (20)

DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 AmsterdamDEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
 
ICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesICT role in 21st century education and its challenges
ICT role in 21st century education and its challenges
 
[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf
 
Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
CNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In PakistanCNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In Pakistan
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
 
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
 
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
 
FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 

Webpack and Web Performance Optimization

  • 1. Webpack and Web Performance Optimization Blackie.Tsai Blackie.tsai@xuenn.com 2016/11/18
  • 2. Agenda • Webpack Introduction • Web Optimization • Modularized Javascript and React • Collaborate with .net MVC
  • 4. • Today’s Web Apps Trendy • More and more JavaScript is being used. • Modern browsers are offering a wider range of interfaces. • Fewer full page reloads → even more code in a page • As a result there is a lot of code on the client side! A big code base needs to be organized. Module systems offer the option to split your code base into modules Current problems
  • 5. Webpack - A Module Bundler • A bundler for javascript and friends. Packs many modules into a few bundled assets. Code Splitting allows to load parts for the application on demand. Through "loaders," modules can be CommonJs, AMD, ES6 modules, CSS, Images, JSON, Coffeescript, LESS, ... and your custom stuff. https://webpack.github.io • Usage: https://webpack.github.io/docs/tutorials/getting-started/
  • 6. Goals • Split the dependency tree into chunks loaded on demand • Keep initial loading time low • Every static asset should be able to be a module • Ability to integrate 3rd-party libraries as modules • Ability to customize nearly every part of the module bundler • Suited for big projects
  • 7. Features • Code Splitting • allows you to split your codebase into multiple chunks. Chunks are loaded asynchronously at runtime. This reduces the initial loading time. • Optimizations • can do many optimizations to reduce the output size of your JavaScript by de-duplicating frequently used modules, minifying, and giving you full control of what is loaded initially and what is loaded at runtime through code splitting. • Loaders • enables use of loaders to preprocess files. This allows you to bundle any static resource way beyond JavaScript. You can easily write your own loaders using node.js. • Module Format (AMD/CommonJS) • supports both AMD and CommonJS module styles. • Plug-in System • webpack features a rich plugin system and allows you to customize
  • 9. Loader • Loaders allow you to preprocess files as you require() or “load” them. • Loaders are kind of like “tasks” in other build tools, and provide a powerful way to handle frontend build steps. • Loaders can transform files from a different language like, CoffeeScript to JavaScript, or inline images as data URLs. • Loaders even allow you to do things like require() css files right in your JavaScript! You can import other Loaders to help you. • E.g. CSS-LOADER, IMAGE LOADER, BUNDLE-LOADER
  • 10. Loader - Sample • Webpack transform a module with a loader • ! syntax separating the loader from the module path? Loaders, like modules can also be specified with a relative path (as if you were requiring it) instead of the loader name • Chained together by separating loaders with the ! • Loaders with Parameters • loaders by config var moduleWithOneLoader = require("my-loader!./my-awesome-module"); var moduleWithLoaders = require("style-loader!css-loader!less-loader!./my-styles.less"); var moduleWithLoaderHasParameters = require("loader?with=parameter!./file"); { module: { loaders: [ { test: /.coffee$/, loader: "coffee-loader" } ], preLoaders: [ { test: /.coffee$/, loader: "coffee-hint-loader" } ] } };
  • 11. Webpack Config File • entry • Setup entry file • output • Determine output path and file name • module(optional) • Setup loaders
  • 13. NodeJS • Node.js® is a JavaScript runtime built on Chrome's V8 JavaScript engine. Node.js uses an event-driven, non-blocking I/O model that makes it lightweight and efficient. • Node.js' package ecosystem, npm, is the largest ecosystem of open source libraries in the world. • https://nodejs.org/dist/v4.5.0/node-v4.5.0-x64.msi • https://nodejs.org/dist/v6.6.0/node-v6.6.0-x64.msi
  • 14. [NPM]Webpack • https://www.npmjs.com/package/webpack • Setup • Project: npm install webpack --save-dev • Global: npm install webpack –g • Common Commands(usually execute with webpack.config.js file) • webpack:execute one time in dev mode. E.g. webpack main.js bundle.js • webpack -p: execute for production-ready • webpack --watch:execute and watch change to execute on background • webpack --progress --colors: execute with progress bar and colors
  • 16. WebPack Task Runner • https://visualstudiogallery.msdn.microsoft.com/5497fd10-b1ba- 474c-8991-1438ae47012a
  • 20. • Unoptimized Resource(js, css, images) • Sites impacted: 90% • Content Served Without HTTP Compression • Sites impacted: 72% • Without Concatenate Resource(js, css or images) to one Request • Sites impacted: 69% • Too much HTTP Requests • Sites impacted: 69% • Without Caching Information • Sites impacted: 65% • Domain Sharding Not Implemented • Sites impacted: 64% Top issue for Web Performance
  • 21. • Image Optimization • Reduce HTTP Requests • Minify CSS and Javascript • Critical Path and Render Blocking Resources (CSS + JS) • Reduce Latency with a CDN • Avoid 301 Redirects • Caching • Web Font Performance • Enable Gzip Compression • Fix 404 Errors • Serve Scaled Images Top tips for Web Performance Optimization
  • 22. Adaptive Web Concept Header HTML iframe img media • CSS, icon and fonts • Most file can Concatenate (CSS merge and image sprite ) • Loading first and sequence with blocking • Body content, JS and other resource • Bigger file size than Header • Most file can’t Concatenate (exclude JS bundle and image sprite ) • Loading/Executing later when read the content with non-blocking body
  • 24. Delaying Image Loading • a.k.a Image Lazy Loading Solution To Lazy Loading SEO Impact
  • 25. Web Optimize Before Mobile Lite • Now • SBK have 15 requests for total 500KB transferred • 188 have 8 requests for total 600KB transferred • Action • Eliminate render-blocking JavaScript and CSS in above-the-fold content • Less request • Can improve 40% for latency issue on too many requests, from 23 to 14 • SBK • Combine JS request • 188(Brand) • Combine JS request • Refine 188(Brand) header/footer for provide less request version for SBK
  • 26. Reduce less with low User impact • Changes • General • No image(jpg, png and gif) file • Use CSS, Font(include icon) and HTML • Only one kind of font for Mobile Lite(Only Lato-Regular, no Lato-Bold) • Pagination for Today • Homepage • No image on each feature event • All Market • Score Board with simple background color • Estimated improvement • Reduce 4 request • Reduce 180 KB
  • 27. Reduce more but high User impact • Changes • General • No Auto refresh, using manually refresh(e.g. can click every 30s) • All Market • No Live Center(5 sec auto-refresh with 2.5 KB=>1 min with 30KB) • Estimated improvement • Reduce 1 request • Reduce 20 KB(exclude Live Center)
  • 28. Cut function but Company impact • Changes • Homepage • Only display 1st feature event • Only display top N priority sports events • Main Odds • Only display top N priority competition event • All Market • Display predefine priority markets only • Estimated improvement • Reduce 50 KB
  • 29. Comparison Original Web Optimized Low User Impact High User Impact Company Impact Request 23 14 10 9 9 Transferred size(KB) 1, 100 1,100 920 930 880
  • 31. Gulp Gulp is a Task Runner build by JavaScript to help automation. The less work you have to do when performing repetitive tasks like minification, compilation, unit testing, linting, etc. After you've configured it through a Gulpfile, a task runner can do most of that mundane work for team •Minify JavaScript, CSS files •Combine JavaScript, CSS files(including compile Sass and Less) and Image Sprites •Testing •Format or Code Rule check
  • 32. Development Flow - Developing • Integrate with Visual Studio with Task Runner Explorer, Gulp for VS • Help doing below task when ITC doing developing • Concatenation and minifying • Compile SASS file to CSS file on runtime • Testing minify JavaScript, CSS files • Testing combine JavaScript, CSS files(Sass and Less) and Image Sprites • Validate front-end coding rule
  • 33. Gulp Plugin • gulp-concat:file concatenate • gulp-minify-css: CSS minifying • gulp-uglify: Compressed Javascript(Can replace by Webpack) • gulp-rename:File rename • gulp-html-replace :Replace target source path • gulp-minify-html : Compressed HTML • Ref • http://www.oxxostudio.tw/articles/201503/gulp-2-compress-js-css.html • http://www.oxxostudio.tw/articles/201503/gulp-3-compress-html.html
  • 34. Integrate with Webpack • With webpack-stream (not recommened) • https://github.com/shama/webpack-stream • Run webpack as a stream to conveniently integrate with gulp. • Big issue=>gulp & webpack整合,鱼与熊掌我都要! • Without webpack-stream • https://webpack.github.io/docs/usage-with-gulp.html var gulp = require("gulp"); var gutil = require("gulp-util"); var webpack = require("webpack"); var WebpackDevServer = require("webpack-dev-server"); gulp.task("webpack", function(callback) { // run webpack webpack({ // configuration }, function(err, stats) { if(err) throw new gutil.PluginError("webpack", err); gutil.log("[webpack]", stats.toString({ // output options })); callback(); }); });
  • 35. Development Flow – Build and Release • Gulp help doing below task • Compile SASS file to CSS file • Minify JavaScript, CSS, HTML files(Release version) • Concatenate JavaScript, CSS files(including compile Sass and Less) and Image Sprites(Release version) • [Optional]Generate Format or Code Rule report • [Optional]Generate Front-end test report • Jenkins help doing below task • Trigger Grunt to build Release version • Build and Release DEV(daily) • Validate Unit test • Validate Integration test • Validate Automation test(Selenium) • Validate Web performance test(YSlow, Phantomjs or etc…) • Build and Release QAT • Prepare UAT release package • Aggregate and Sent release report
  • 36. • General • Avoid 301 Redirects • Fix All 404 Errors • Loading Resources On-demand • Avoid Render Blocking • Static content optimize • Concatenate(CSS merge、JS bundle、image sprite ) • Compression(gzip、minify, image compression) • Request optimize • CDN • Front-end Cache • Request Tuning and Combine • Domain Sharding Web Optimize
  • 38. Modularized JavaScript • Pros • Encapsulation • Decoupling • Organization • No global scope pollution • Security • Re-use • Cons • More difficult to release • Complex dependency
  • 42. Babel - A Tool to convert ES6 to ES5 • A Tool to convert ES6 to ES5 • Babel is the most popular tool used to convert ES6 to ES5. It has various interfaces like a CLI, Node-module and also an online converter. I use the node module for my apps and use theonline version to quickly see the differences. • Why ES6 • 5 JavaScript “Bad” Parts That Are Fixed In ES6 • Modularized for React, Babel can convert JSX syntax and strip out type annotations.
  • 44. Grunt/Gulp for React • Not all browsers are supporting ES6 yet, so we're going to have to transpile our ES6 code, turning it into ES5. We're also going to have to handle 'JSX', the special Javascript that we can use for React. We also need to play well with existing code.
  • 45. Webpack for React • Webpack is a bundler. It'll take a bunch of loose Javascript files and build a single file from the lot
  • 46. Webpack+Babel for React • Even better, we can configure webpack to run files that match a certain pattern to go through other 'loaders', which can process the files further. • We can use the Babel transpiler to turn an ES6 file to ES5. We just need the glue to let Webpack use Babel as a loader. That comes in the form of the Babel Loader:
  • 47. Babel-loader • This package allows transpiling JavaScript files using Babel and webpack. https://github.com/babel/babel-loader
  • 48. Dependency • React uses JSX as the XML-like syntax extension over JavaScript to specify component tree structure, data flow, and event handlers. JSX is processed by Webpack module bundler using specific loaders or convertors.
  • 50. Visual Studio 2015 with latest update • https://blogs.msdn.microsoft.com/visualstudio/2015/06/10/javas cript-editor-improvements-in-visual-studio-2015/ • https://www.visualstudio.com/en-us/news/vs2015-update1- vs.aspx • React's JSX is now natively supported • ECMAScript 2015 (formerly ECMAScript 6) support
  • 51. React Snippet Pack • https://visualstudiogallery.msdn.microsoft.com/234d79e9-f0fd- 41e1-a926-850da8e8c7d7
  • 53. • Demo Download • Original post : detail of how to setup up front-end in asp.net core and MVC5, sample is clone from AspNetReactSamples • Setup • Install node and NPM • Go to root directory and use NPM to install js dependency • npm install • Build with install nuget dependency • Run App Demo
  • 59. Reference • 設定開發React的環境 • 設定開發React的環境 - React Hot Loader • Production optimization with React and Webpack
  • 60. Q & A
  • 61. 11F., No.399, Ruiguang Rd., Neihu Dist., Taipei City 114, Taiwan TEL: +886 2 2798 8529 Fax: +886 2 2798 8531 Website : www.xuenn.com THANK YOU!
  • 62. Reference • WEBPACK入門教學筆記 • 18 Tips for Website Performance Optimization • Performance Guide for Tizen Web Applications(1): Resource Loading • How-To: Integrate Webpack into Visual Studio 2015 • webpack-howto • Pro React : Appendix A: Webpack for React • 如何使用 Webpack 模組整合工具 • Webpack: your final module bundler • Getting Started with React & ES6 • React Speed Coding • Parallel Downloads Across Domains
  • 63. • dependencies are installed on both: • npm install from a directory that contains package.json • npm install $package on any other directory • devDependencies are: • also installed on npm install on a directory that contains package.json, unless you pass the --production flag • not installed on npm install "$package" on any other directory, unless you give it the --dev option. • are not installed transitively. • Most important • dependencies are required to run, devDependencies only to develop, e.g.: unit tests, Coffeescript to Javascript transpilation, minification, ... [NPM] dependencies and devDependencies