SlideShare a Scribd company logo
1 of 20
Webpack Essentials
With a focus on performance optimization!
Mintbean.io - February 19, 2021
Agenda (~30 min)
Quick Intro of Me!
Why Does Webpack Exist?
What Webpack Is
Optimizing Webpack (the fun stuff!)
Discussion / Q & A
Quick Intro
Software Engineer @ Tesla
● 6 + years in tech
● Customer Success to Software Engineer
● Completed App Academy
● My website
Why Does Webpack Exist?
Without Webpack
With Webpack
Imagine managing that with 50
JS files and many CSS/SCSS files.
More on this
Image Source
What Is Webpack?
Image Source
Quick Demo
Github repo here
Optimizing Webpack - Why does it matter?
You have no control over how users load your site.
Internet speeds and device computing power vary drastically.
Optimizing Webpack - How?
The less the browser has to load, the faster the user experience will generally be.
So - focus on optimizations towards a small bundle.js file
Optimizing Webpack
Three intertwined optimization levers:
1) Build Time
a) Monitoring/analysis
b) Separating development and production builds
1) Small Bundle Size
a) Monitoring/analysis
b) Bundle size reduction
c) Tree Shaking
d) Minifying / Uglifying
1) Browser Loading Techniques
a) Lazy loading in browser (aka “code splitting”)
Local
Production
Optimizing (Browser Load Techniques) - Code Splitting
Image source
The browser only loads sections of code when they are needed instead of loading
everything up front on first load. (Webpack Docs)
- Compare load time using Lighthouse before and after code splitting
Optimizing (Bundle Size) - Uglify / Minify
webpack.config.js
JavaScript Input JavaScript Output
Less readable and takes up less space
UglifyJS Webpack Plugin
Online Minifier Demo
Optimizing (Bundle Size) - Tree Shaking Pt. 1
Image source
Optimizing (Bundle Size) - Tree Shaking Pt 2.
- Google Developer guide to Tree Shaking
“The difference between [the second] import example and the previous one is that
rather than importing everything from the "array-utils" module (which could be a lot
of stuff!), this example imports only specific parts of it. In dev builds, this doesn't
really change anything, as the entire module gets imported regardless. In production
builds, however, we can configure webpack to "shake" off exports from ES6 modules
that weren't explicitly imported, making those production builds smaller.”
Before Tree Shaking After Tree Shaking
Optimizing (Build) - Development vs Production
Tutorial
Split dev and prod
webpack builds to
fine tune dev
webpack build for
quick hot
reloading.
(Real life example
of the value of this
on the next slide)
Image source
Optimizing (Build) - Monitoring/Analysis Pt. 1
speed-measure-webpack-plugin
Dev build - faster build time, faster hot
reload, faster developing! 🎉
Prod build - longer build time but uses a
plugin needed for prod deployment.
Early detection of large module sizes in development flow before even building.
Optimizing (Bundle Size) - Monitoring/Analysis Pt. 2
Import Cost VSCode Extension
Optimizing (Bundle Size) - Monitoring/Analysis Pt. 3
More on other visual bundle analysis tools
DEMO TIME!
Image Source
Optimizing - Final Thoughts
Layered monitoring strategies in your workflow.
Develop an awareness of module sizes before they become entrenched in your app.
Discussion / Q&A
Webpack is a massive topic with a huge ecosystem/community of plugins. Go
explore! See more on the Webpack docs page.
Some other topics we could discuss:
- Transpilers (ex: Babel)
- Webpack Dev Server
- Sourcemaps/Stacktrace - aka ‘what line did the error happen?’
- Webpack + Docker staged production builds
- Dependency graphs
- Modules, plugins, or other general Webpack concepts
Appendix
CODE EXAMPLE FOR Uglify online: https://skalman.github.io/UglifyJS-online/
function getIntoAnArgument() {
var args = arguments.slice();
args.forEach(function(arg) {
console.log(arg);
});
}
module.exports = {
haste: {
hasteImplModulePath: require.resolve('./noHaste.js'),
},
modulePathIgnorePatterns: [
'<rootDir>/scripts/rollup/shims/',
'<rootDir>/scripts/bench/',
],
transform: {
'.*': require.resolve('./preprocessor.js'),
},
setupFiles: [require.resolve('./setupEnvironment.js')],
setupFilesAfterEnv: [require.resolve('./setupTests.js')],
// Only include files directly in __tests__, not in nested folders.
testRegex: '/__tests__/[^/]*(.js|.coffee|[^d].ts)$',
moduleFileExtensions: ['js', 'json', 'node', 'coffee', 'ts'],
rootDir: process.cwd(),
roots: ['<rootDir>/packages', '<rootDir>/scripts'],
collectCoverageFrom: ['packages/**/*.js'],
timers: 'fake',
snapshotSerializers: [require.resolve('jest-snapshot-serializer-raw')],
testSequencer: require.resolve('./jestSequencer'),
// TODO: Upgrade to Jest 26 which uses jsdom 16 by default.
testEnvironment: require.resolve('jest-environment-jsdom-sixteen'),
};

More Related Content

What's hot

Google Cloud Computing compares GCE, GAE and GKE
Google Cloud Computing compares GCE, GAE and GKEGoogle Cloud Computing compares GCE, GAE and GKE
Google Cloud Computing compares GCE, GAE and GKESimon Su
 
"13 ways to run web applications on the Internet" Andrii Shumada
"13 ways to run web applications on the Internet" Andrii Shumada"13 ways to run web applications on the Internet" Andrii Shumada
"13 ways to run web applications on the Internet" Andrii ShumadaFwdays
 
Scale tests nodepool
Scale tests nodepoolScale tests nodepool
Scale tests nodepoolYolanda Robla
 
The Prowess of Prow
The Prowess of Prow  The Prowess of Prow
The Prowess of Prow Hemani Katyal
 
Automated Development Workflow with Gulp
Automated Development Workflow with GulpAutomated Development Workflow with Gulp
Automated Development Workflow with Gulpplewicki
 
[Container X mas Party with flexy] Machine Learning Lifecycle with Kubeflow o...
[Container X mas Party with flexy] Machine Learning Lifecycle with Kubeflow o...[Container X mas Party with flexy] Machine Learning Lifecycle with Kubeflow o...
[Container X mas Party with flexy] Machine Learning Lifecycle with Kubeflow o...Naoki (Neo) SATO
 
Automated OVA deployments using OpenStack infrastructure
Automated OVA deployments using OpenStack infrastructureAutomated OVA deployments using OpenStack infrastructure
Automated OVA deployments using OpenStack infrastructureYolanda Robla
 
Time's Important - Let Task Management Save Yours
Time's Important - Let Task Management Save YoursTime's Important - Let Task Management Save Yours
Time's Important - Let Task Management Save YoursJames Bundey
 
Hw accelerated webkitgtk+ on raspberry pi
Hw accelerated webkitgtk+ on raspberry piHw accelerated webkitgtk+ on raspberry pi
Hw accelerated webkitgtk+ on raspberry pignomekr
 
NodeSummit - MEAN Stack
NodeSummit - MEAN StackNodeSummit - MEAN Stack
NodeSummit - MEAN StackValeri Karpov
 
Google compute engine - overview
Google compute engine - overviewGoogle compute engine - overview
Google compute engine - overviewCharles Fan
 
[143]Inside fuse deview 2016
[143]Inside fuse   deview 2016[143]Inside fuse   deview 2016
[143]Inside fuse deview 2016NAVER D2
 
WordPress London Developer Operations For Beginners
WordPress London Developer Operations For BeginnersWordPress London Developer Operations For Beginners
WordPress London Developer Operations For BeginnersStewart Ritchie
 
Modern infrastructure as code with ansible cake fest 2021
Modern infrastructure as code with ansible cake fest 2021Modern infrastructure as code with ansible cake fest 2021
Modern infrastructure as code with ansible cake fest 2021Joe Ferguson
 
Django oscar introduction
Django oscar introductionDjango oscar introduction
Django oscar introductionKAI CHU CHUNG
 
Gae managed vm introduction
Gae managed vm introductionGae managed vm introduction
Gae managed vm introductionKAI CHU CHUNG
 
Nyc kubernetes Meetup - Kubeflow Lightning talk
Nyc kubernetes Meetup - Kubeflow Lightning talkNyc kubernetes Meetup - Kubeflow Lightning talk
Nyc kubernetes Meetup - Kubeflow Lightning talkAdhita Selvaraj
 

What's hot (20)

Google Cloud Computing compares GCE, GAE and GKE
Google Cloud Computing compares GCE, GAE and GKEGoogle Cloud Computing compares GCE, GAE and GKE
Google Cloud Computing compares GCE, GAE and GKE
 
Speed = $$$
Speed = $$$Speed = $$$
Speed = $$$
 
"13 ways to run web applications on the Internet" Andrii Shumada
"13 ways to run web applications on the Internet" Andrii Shumada"13 ways to run web applications on the Internet" Andrii Shumada
"13 ways to run web applications on the Internet" Andrii Shumada
 
Scale tests nodepool
Scale tests nodepoolScale tests nodepool
Scale tests nodepool
 
The Prowess of Prow
The Prowess of Prow  The Prowess of Prow
The Prowess of Prow
 
Automated Development Workflow with Gulp
Automated Development Workflow with GulpAutomated Development Workflow with Gulp
Automated Development Workflow with Gulp
 
[Container X mas Party with flexy] Machine Learning Lifecycle with Kubeflow o...
[Container X mas Party with flexy] Machine Learning Lifecycle with Kubeflow o...[Container X mas Party with flexy] Machine Learning Lifecycle with Kubeflow o...
[Container X mas Party with flexy] Machine Learning Lifecycle with Kubeflow o...
 
Automated OVA deployments using OpenStack infrastructure
Automated OVA deployments using OpenStack infrastructureAutomated OVA deployments using OpenStack infrastructure
Automated OVA deployments using OpenStack infrastructure
 
Time's Important - Let Task Management Save Yours
Time's Important - Let Task Management Save YoursTime's Important - Let Task Management Save Yours
Time's Important - Let Task Management Save Yours
 
Hw accelerated webkitgtk+ on raspberry pi
Hw accelerated webkitgtk+ on raspberry piHw accelerated webkitgtk+ on raspberry pi
Hw accelerated webkitgtk+ on raspberry pi
 
NodeSummit - MEAN Stack
NodeSummit - MEAN StackNodeSummit - MEAN Stack
NodeSummit - MEAN Stack
 
Google compute engine - overview
Google compute engine - overviewGoogle compute engine - overview
Google compute engine - overview
 
[143]Inside fuse deview 2016
[143]Inside fuse   deview 2016[143]Inside fuse   deview 2016
[143]Inside fuse deview 2016
 
WordPress London Developer Operations For Beginners
WordPress London Developer Operations For BeginnersWordPress London Developer Operations For Beginners
WordPress London Developer Operations For Beginners
 
Modern infrastructure as code with ansible cake fest 2021
Modern infrastructure as code with ansible cake fest 2021Modern infrastructure as code with ansible cake fest 2021
Modern infrastructure as code with ansible cake fest 2021
 
Modern web technologies
Modern web technologiesModern web technologies
Modern web technologies
 
Django oscar introduction
Django oscar introductionDjango oscar introduction
Django oscar introduction
 
Gulp: Task Runner
Gulp: Task RunnerGulp: Task Runner
Gulp: Task Runner
 
Gae managed vm introduction
Gae managed vm introductionGae managed vm introduction
Gae managed vm introduction
 
Nyc kubernetes Meetup - Kubeflow Lightning talk
Nyc kubernetes Meetup - Kubeflow Lightning talkNyc kubernetes Meetup - Kubeflow Lightning talk
Nyc kubernetes Meetup - Kubeflow Lightning talk
 

Similar to Webpack essentails - feb 19, 2020

Andrew Mykhaliuk - Sorry, I need to make a build for frontend
Andrew Mykhaliuk - Sorry, I need to make a build for frontendAndrew Mykhaliuk - Sorry, I need to make a build for frontend
Andrew Mykhaliuk - Sorry, I need to make a build for frontendOdessaJS Conf
 
Improving Drupal Performances
Improving Drupal PerformancesImproving Drupal Performances
Improving Drupal PerformancesVladimir Ilic
 
Moving from CruiseControl.NET to Jenkins in the PVS-Studio development team
Moving from CruiseControl.NET to Jenkins in the PVS-Studio development teamMoving from CruiseControl.NET to Jenkins in the PVS-Studio development team
Moving from CruiseControl.NET to Jenkins in the PVS-Studio development teamSofia Fateeva
 
Moving from CruiseControl.NET to Jenkins in the PVS-Studio development team
Moving from CruiseControl.NET to Jenkins in the PVS-Studio development teamMoving from CruiseControl.NET to Jenkins in the PVS-Studio development team
Moving from CruiseControl.NET to Jenkins in the PVS-Studio development teamPVS-Studio
 
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.pdfSufalam Technologies
 
Production optimization with React and Webpack
Production optimization with React and WebpackProduction optimization with React and Webpack
Production optimization with React and Webpackk88hudson
 
Decrease build time and application size
Decrease build time and application sizeDecrease build time and application size
Decrease build time and application sizeKeval Patel
 
Keeping your build tool updated in a multi repository world
Keeping your build tool updated in a multi repository worldKeeping your build tool updated in a multi repository world
Keeping your build tool updated in a multi repository worldRoberto Pérez Alcolea
 
AEM Best Practices for Component Development
AEM Best Practices for Component DevelopmentAEM Best Practices for Component Development
AEM Best Practices for Component DevelopmentGabriel Walt
 
Modern Web Applications with Sightly
Modern Web Applications with SightlyModern Web Applications with Sightly
Modern Web Applications with SightlyRadu Cotescu
 
Lean microservices through ahead of time compilation (Tobias Piper, Loveholid...
Lean microservices through ahead of time compilation (Tobias Piper, Loveholid...Lean microservices through ahead of time compilation (Tobias Piper, Loveholid...
Lean microservices through ahead of time compilation (Tobias Piper, Loveholid...London Microservices
 
Maven: Managing Software Projects for Repeatable Results
Maven: Managing Software Projects for Repeatable ResultsMaven: Managing Software Projects for Repeatable Results
Maven: Managing Software Projects for Repeatable ResultsSteve Keener
 
Igalia Focus and Goals 2020 (2019 WebKit Contributors Meeting)
Igalia Focus and Goals 2020 (2019 WebKit Contributors Meeting)Igalia Focus and Goals 2020 (2019 WebKit Contributors Meeting)
Igalia Focus and Goals 2020 (2019 WebKit Contributors Meeting)Igalia
 
Automating the consumption of Eclipse for internal use
Automating the consumption of Eclipse for internal useAutomating the consumption of Eclipse for internal use
Automating the consumption of Eclipse for internal usePascal Rapicault
 
DOs and DONTs on the way to 10M users
DOs and DONTs on the way to 10M usersDOs and DONTs on the way to 10M users
DOs and DONTs on the way to 10M usersYoav Avrahami
 
Migraine Drupal - syncing your staging and live sites
Migraine Drupal - syncing your staging and live sitesMigraine Drupal - syncing your staging and live sites
Migraine Drupal - syncing your staging and live sitesdrupalindia
 
Workflow automation for Front-end web applications
Workflow automation for Front-end web applicationsWorkflow automation for Front-end web applications
Workflow automation for Front-end web applicationsMayank Patel
 
Care and feeding notes
Care and feeding notesCare and feeding notes
Care and feeding notesPerrin Harkins
 

Similar to Webpack essentails - feb 19, 2020 (20)

Andrew Mykhaliuk - Sorry, I need to make a build for frontend
Andrew Mykhaliuk - Sorry, I need to make a build for frontendAndrew Mykhaliuk - Sorry, I need to make a build for frontend
Andrew Mykhaliuk - Sorry, I need to make a build for frontend
 
Improving Drupal Performances
Improving Drupal PerformancesImproving Drupal Performances
Improving Drupal Performances
 
Moving from CruiseControl.NET to Jenkins in the PVS-Studio development team
Moving from CruiseControl.NET to Jenkins in the PVS-Studio development teamMoving from CruiseControl.NET to Jenkins in the PVS-Studio development team
Moving from CruiseControl.NET to Jenkins in the PVS-Studio development team
 
Moving from CruiseControl.NET to Jenkins in the PVS-Studio development team
Moving from CruiseControl.NET to Jenkins in the PVS-Studio development teamMoving from CruiseControl.NET to Jenkins in the PVS-Studio development team
Moving from CruiseControl.NET to Jenkins in the PVS-Studio development team
 
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
 
Production optimization with React and Webpack
Production optimization with React and WebpackProduction optimization with React and Webpack
Production optimization with React and Webpack
 
Building JavaScript
Building JavaScriptBuilding JavaScript
Building JavaScript
 
Decrease build time and application size
Decrease build time and application sizeDecrease build time and application size
Decrease build time and application size
 
Keeping your build tool updated in a multi repository world
Keeping your build tool updated in a multi repository worldKeeping your build tool updated in a multi repository world
Keeping your build tool updated in a multi repository world
 
AEM Best Practices for Component Development
AEM Best Practices for Component DevelopmentAEM Best Practices for Component Development
AEM Best Practices for Component Development
 
Modern Web Applications with Sightly
Modern Web Applications with SightlyModern Web Applications with Sightly
Modern Web Applications with Sightly
 
Lean microservices through ahead of time compilation (Tobias Piper, Loveholid...
Lean microservices through ahead of time compilation (Tobias Piper, Loveholid...Lean microservices through ahead of time compilation (Tobias Piper, Loveholid...
Lean microservices through ahead of time compilation (Tobias Piper, Loveholid...
 
Maven: Managing Software Projects for Repeatable Results
Maven: Managing Software Projects for Repeatable ResultsMaven: Managing Software Projects for Repeatable Results
Maven: Managing Software Projects for Repeatable Results
 
Igalia Focus and Goals 2020 (2019 WebKit Contributors Meeting)
Igalia Focus and Goals 2020 (2019 WebKit Contributors Meeting)Igalia Focus and Goals 2020 (2019 WebKit Contributors Meeting)
Igalia Focus and Goals 2020 (2019 WebKit Contributors Meeting)
 
Automating the consumption of Eclipse for internal use
Automating the consumption of Eclipse for internal useAutomating the consumption of Eclipse for internal use
Automating the consumption of Eclipse for internal use
 
DOs and DONTs on the way to 10M users
DOs and DONTs on the way to 10M usersDOs and DONTs on the way to 10M users
DOs and DONTs on the way to 10M users
 
Migraine Drupal - syncing your staging and live sites
Migraine Drupal - syncing your staging and live sitesMigraine Drupal - syncing your staging and live sites
Migraine Drupal - syncing your staging and live sites
 
Webpack: from 0 to 2
Webpack: from 0 to 2Webpack: from 0 to 2
Webpack: from 0 to 2
 
Workflow automation for Front-end web applications
Workflow automation for Front-end web applicationsWorkflow automation for Front-end web applications
Workflow automation for Front-end web applications
 
Care and feeding notes
Care and feeding notesCare and feeding notes
Care and feeding notes
 

Recently uploaded

Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed Data
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed DataAlluxio Monthly Webinar | Cloud-Native Model Training on Distributed Data
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed DataAlluxio, Inc.
 
Building Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop SlideBuilding Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop SlideChristina Lin
 
Der Spagat zwischen BIAS und FAIRNESS (2024)
Der Spagat zwischen BIAS und FAIRNESS (2024)Der Spagat zwischen BIAS und FAIRNESS (2024)
Der Spagat zwischen BIAS und FAIRNESS (2024)OPEN KNOWLEDGE GmbH
 
Open Source Summit NA 2024: Open Source Cloud Costs - OpenCost's Impact on En...
Open Source Summit NA 2024: Open Source Cloud Costs - OpenCost's Impact on En...Open Source Summit NA 2024: Open Source Cloud Costs - OpenCost's Impact on En...
Open Source Summit NA 2024: Open Source Cloud Costs - OpenCost's Impact on En...Matt Ray
 
Xen Safety Embedded OSS Summit April 2024 v4.pdf
Xen Safety Embedded OSS Summit April 2024 v4.pdfXen Safety Embedded OSS Summit April 2024 v4.pdf
Xen Safety Embedded OSS Summit April 2024 v4.pdfStefano Stabellini
 
MYjobs Presentation Django-based project
MYjobs Presentation Django-based projectMYjobs Presentation Django-based project
MYjobs Presentation Django-based projectAnoyGreter
 
Balasore Best It Company|| Top 10 IT Company || Balasore Software company Odisha
Balasore Best It Company|| Top 10 IT Company || Balasore Software company OdishaBalasore Best It Company|| Top 10 IT Company || Balasore Software company Odisha
Balasore Best It Company|| Top 10 IT Company || Balasore Software company Odishasmiwainfosol
 
Folding Cheat Sheet #4 - fourth in a series
Folding Cheat Sheet #4 - fourth in a seriesFolding Cheat Sheet #4 - fourth in a series
Folding Cheat Sheet #4 - fourth in a seriesPhilip Schwarz
 
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024StefanoLambiase
 
How to Track Employee Performance A Comprehensive Guide.pdf
How to Track Employee Performance A Comprehensive Guide.pdfHow to Track Employee Performance A Comprehensive Guide.pdf
How to Track Employee Performance A Comprehensive Guide.pdfLivetecs LLC
 
EY_Graph Database Powered Sustainability
EY_Graph Database Powered SustainabilityEY_Graph Database Powered Sustainability
EY_Graph Database Powered SustainabilityNeo4j
 
英国UN学位证,北安普顿大学毕业证书1:1制作
英国UN学位证,北安普顿大学毕业证书1:1制作英国UN学位证,北安普顿大学毕业证书1:1制作
英国UN学位证,北安普顿大学毕业证书1:1制作qr0udbr0
 
SuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte Germany
SuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte GermanySuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte Germany
SuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte GermanyChristoph Pohl
 
Unveiling the Future: Sylius 2.0 New Features
Unveiling the Future: Sylius 2.0 New FeaturesUnveiling the Future: Sylius 2.0 New Features
Unveiling the Future: Sylius 2.0 New FeaturesŁukasz Chruściel
 
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...stazi3110
 
Intelligent Home Wi-Fi Solutions | ThinkPalm
Intelligent Home Wi-Fi Solutions | ThinkPalmIntelligent Home Wi-Fi Solutions | ThinkPalm
Intelligent Home Wi-Fi Solutions | ThinkPalmSujith Sukumaran
 
Software Project Health Check: Best Practices and Techniques for Your Product...
Software Project Health Check: Best Practices and Techniques for Your Product...Software Project Health Check: Best Practices and Techniques for Your Product...
Software Project Health Check: Best Practices and Techniques for Your Product...Velvetech LLC
 
Cloud Data Center Network Construction - IEEE
Cloud Data Center Network Construction - IEEECloud Data Center Network Construction - IEEE
Cloud Data Center Network Construction - IEEEVICTOR MAESTRE RAMIREZ
 
SpotFlow: Tracking Method Calls and States at Runtime
SpotFlow: Tracking Method Calls and States at RuntimeSpotFlow: Tracking Method Calls and States at Runtime
SpotFlow: Tracking Method Calls and States at Runtimeandrehoraa
 

Recently uploaded (20)

Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed Data
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed DataAlluxio Monthly Webinar | Cloud-Native Model Training on Distributed Data
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed Data
 
Building Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop SlideBuilding Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
 
Der Spagat zwischen BIAS und FAIRNESS (2024)
Der Spagat zwischen BIAS und FAIRNESS (2024)Der Spagat zwischen BIAS und FAIRNESS (2024)
Der Spagat zwischen BIAS und FAIRNESS (2024)
 
Open Source Summit NA 2024: Open Source Cloud Costs - OpenCost's Impact on En...
Open Source Summit NA 2024: Open Source Cloud Costs - OpenCost's Impact on En...Open Source Summit NA 2024: Open Source Cloud Costs - OpenCost's Impact on En...
Open Source Summit NA 2024: Open Source Cloud Costs - OpenCost's Impact on En...
 
Xen Safety Embedded OSS Summit April 2024 v4.pdf
Xen Safety Embedded OSS Summit April 2024 v4.pdfXen Safety Embedded OSS Summit April 2024 v4.pdf
Xen Safety Embedded OSS Summit April 2024 v4.pdf
 
MYjobs Presentation Django-based project
MYjobs Presentation Django-based projectMYjobs Presentation Django-based project
MYjobs Presentation Django-based project
 
2.pdf Ejercicios de programación competitiva
2.pdf Ejercicios de programación competitiva2.pdf Ejercicios de programación competitiva
2.pdf Ejercicios de programación competitiva
 
Balasore Best It Company|| Top 10 IT Company || Balasore Software company Odisha
Balasore Best It Company|| Top 10 IT Company || Balasore Software company OdishaBalasore Best It Company|| Top 10 IT Company || Balasore Software company Odisha
Balasore Best It Company|| Top 10 IT Company || Balasore Software company Odisha
 
Folding Cheat Sheet #4 - fourth in a series
Folding Cheat Sheet #4 - fourth in a seriesFolding Cheat Sheet #4 - fourth in a series
Folding Cheat Sheet #4 - fourth in a series
 
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024
 
How to Track Employee Performance A Comprehensive Guide.pdf
How to Track Employee Performance A Comprehensive Guide.pdfHow to Track Employee Performance A Comprehensive Guide.pdf
How to Track Employee Performance A Comprehensive Guide.pdf
 
EY_Graph Database Powered Sustainability
EY_Graph Database Powered SustainabilityEY_Graph Database Powered Sustainability
EY_Graph Database Powered Sustainability
 
英国UN学位证,北安普顿大学毕业证书1:1制作
英国UN学位证,北安普顿大学毕业证书1:1制作英国UN学位证,北安普顿大学毕业证书1:1制作
英国UN学位证,北安普顿大学毕业证书1:1制作
 
SuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte Germany
SuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte GermanySuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte Germany
SuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte Germany
 
Unveiling the Future: Sylius 2.0 New Features
Unveiling the Future: Sylius 2.0 New FeaturesUnveiling the Future: Sylius 2.0 New Features
Unveiling the Future: Sylius 2.0 New Features
 
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
 
Intelligent Home Wi-Fi Solutions | ThinkPalm
Intelligent Home Wi-Fi Solutions | ThinkPalmIntelligent Home Wi-Fi Solutions | ThinkPalm
Intelligent Home Wi-Fi Solutions | ThinkPalm
 
Software Project Health Check: Best Practices and Techniques for Your Product...
Software Project Health Check: Best Practices and Techniques for Your Product...Software Project Health Check: Best Practices and Techniques for Your Product...
Software Project Health Check: Best Practices and Techniques for Your Product...
 
Cloud Data Center Network Construction - IEEE
Cloud Data Center Network Construction - IEEECloud Data Center Network Construction - IEEE
Cloud Data Center Network Construction - IEEE
 
SpotFlow: Tracking Method Calls and States at Runtime
SpotFlow: Tracking Method Calls and States at RuntimeSpotFlow: Tracking Method Calls and States at Runtime
SpotFlow: Tracking Method Calls and States at Runtime
 

Webpack essentails - feb 19, 2020

  • 1. Webpack Essentials With a focus on performance optimization! Mintbean.io - February 19, 2021
  • 2. Agenda (~30 min) Quick Intro of Me! Why Does Webpack Exist? What Webpack Is Optimizing Webpack (the fun stuff!) Discussion / Q & A
  • 3. Quick Intro Software Engineer @ Tesla ● 6 + years in tech ● Customer Success to Software Engineer ● Completed App Academy ● My website
  • 4. Why Does Webpack Exist? Without Webpack With Webpack Imagine managing that with 50 JS files and many CSS/SCSS files. More on this Image Source
  • 7. Optimizing Webpack - Why does it matter? You have no control over how users load your site. Internet speeds and device computing power vary drastically.
  • 8. Optimizing Webpack - How? The less the browser has to load, the faster the user experience will generally be. So - focus on optimizations towards a small bundle.js file
  • 9. Optimizing Webpack Three intertwined optimization levers: 1) Build Time a) Monitoring/analysis b) Separating development and production builds 1) Small Bundle Size a) Monitoring/analysis b) Bundle size reduction c) Tree Shaking d) Minifying / Uglifying 1) Browser Loading Techniques a) Lazy loading in browser (aka “code splitting”) Local Production
  • 10. Optimizing (Browser Load Techniques) - Code Splitting Image source The browser only loads sections of code when they are needed instead of loading everything up front on first load. (Webpack Docs) - Compare load time using Lighthouse before and after code splitting
  • 11. Optimizing (Bundle Size) - Uglify / Minify webpack.config.js JavaScript Input JavaScript Output Less readable and takes up less space UglifyJS Webpack Plugin Online Minifier Demo
  • 12. Optimizing (Bundle Size) - Tree Shaking Pt. 1 Image source
  • 13. Optimizing (Bundle Size) - Tree Shaking Pt 2. - Google Developer guide to Tree Shaking “The difference between [the second] import example and the previous one is that rather than importing everything from the "array-utils" module (which could be a lot of stuff!), this example imports only specific parts of it. In dev builds, this doesn't really change anything, as the entire module gets imported regardless. In production builds, however, we can configure webpack to "shake" off exports from ES6 modules that weren't explicitly imported, making those production builds smaller.” Before Tree Shaking After Tree Shaking
  • 14. Optimizing (Build) - Development vs Production Tutorial Split dev and prod webpack builds to fine tune dev webpack build for quick hot reloading. (Real life example of the value of this on the next slide) Image source
  • 15. Optimizing (Build) - Monitoring/Analysis Pt. 1 speed-measure-webpack-plugin Dev build - faster build time, faster hot reload, faster developing! 🎉 Prod build - longer build time but uses a plugin needed for prod deployment.
  • 16. Early detection of large module sizes in development flow before even building. Optimizing (Bundle Size) - Monitoring/Analysis Pt. 2 Import Cost VSCode Extension
  • 17. Optimizing (Bundle Size) - Monitoring/Analysis Pt. 3 More on other visual bundle analysis tools DEMO TIME! Image Source
  • 18. Optimizing - Final Thoughts Layered monitoring strategies in your workflow. Develop an awareness of module sizes before they become entrenched in your app.
  • 19. Discussion / Q&A Webpack is a massive topic with a huge ecosystem/community of plugins. Go explore! See more on the Webpack docs page. Some other topics we could discuss: - Transpilers (ex: Babel) - Webpack Dev Server - Sourcemaps/Stacktrace - aka ‘what line did the error happen?’ - Webpack + Docker staged production builds - Dependency graphs - Modules, plugins, or other general Webpack concepts
  • 20. Appendix CODE EXAMPLE FOR Uglify online: https://skalman.github.io/UglifyJS-online/ function getIntoAnArgument() { var args = arguments.slice(); args.forEach(function(arg) { console.log(arg); }); } module.exports = { haste: { hasteImplModulePath: require.resolve('./noHaste.js'), }, modulePathIgnorePatterns: [ '<rootDir>/scripts/rollup/shims/', '<rootDir>/scripts/bench/', ], transform: { '.*': require.resolve('./preprocessor.js'), }, setupFiles: [require.resolve('./setupEnvironment.js')], setupFilesAfterEnv: [require.resolve('./setupTests.js')], // Only include files directly in __tests__, not in nested folders. testRegex: '/__tests__/[^/]*(.js|.coffee|[^d].ts)$', moduleFileExtensions: ['js', 'json', 'node', 'coffee', 'ts'], rootDir: process.cwd(), roots: ['<rootDir>/packages', '<rootDir>/scripts'], collectCoverageFrom: ['packages/**/*.js'], timers: 'fake', snapshotSerializers: [require.resolve('jest-snapshot-serializer-raw')], testSequencer: require.resolve('./jestSequencer'), // TODO: Upgrade to Jest 26 which uses jsdom 16 by default. testEnvironment: require.resolve('jest-environment-jsdom-sixteen'), };