SurviveJS - Webpack 5
$19.99
Minimum price
$19.99
Suggested price

SurviveJS - Webpack 5

From apprentice to master

About the Book

"SurviveJS - Webpack 5" has been built around a tutorial during which you develop a complex configuration while covering different facets of webpack. The 34 short chapters and six appendices work as a reference you can use while developing your web applications. The book has been written with webpack 5 in mind.

Even though the book has been designed around webpack, many of the techniques covered go beyond it. You will learn to improve the quality of your code while becoming aware of optimization techniques that help you to deliver more performant web applications.

The book was developed in collaboration with the webpack community, and its structure has evolved accordingly. A third of royalties go to Tobias Koppers, the author of the tool. The writer is a core developer of webpack so by purchasing this book you will support the effort in multiple ways.

The content has been split as below:

  • Foreword by Tobias Koppers, the author of webpack
  • Preface by Juho Vepsäläinen, the author of the book and a core developer of webpack
  • What is Webpack? - Learn what makes webpack tick
  • Developing - Set up a development environment on top of webpack
  • Styling - Load and manage styles while learning about topics like autoprefixing and eliminating unused CSS
  • Loading Assets - Load different asset types and process them
  • Building - Write initial build with webpack and learn techniques like bundle and code splitting
  • Optimizing - Learn to optimize the build results by minifying, tree shaking, and other techniques
  • Output - Understand webpack's output formats, multiple page builds, and module federation
  • Techniques - Learn specific techniques related to topics such as testing and consuming packages
  • Extending - Extend webpack with loaders and plugins
  • Conclusion - Recap core techniques
  • Appendices - Learn how webpack compares with other tools, how to set up Hot Module Replacement, troubleshoot webpack
The Leanpub edition comes with a two page PDF cheatsheet that covers the main ideas of webpack in a compact format. It's also available in poster form (single A3, either portrait or landscape). You also get a ~20 page QA PDF where Tobias Koppers, the creator of the tool answers to tough questions.
  • Share this book

  • Categories

    • Software Engineering
    • JavaScript
    • React
    • ES6
    • Web Development
  • Feedback

    Email the Author(s)
  • License

About the Authors

Juho Vepsäläinen
Juho Vepsäläinen

Juho Vepsäläinen is behind the SurviveJS effort. In addition to being a core developer of webpack, I have been active in the open source scene since the early 2000s. Blue Arrow Awards winner.

Jesús Rodríguez Rodríguez
Jesús Rodríguez Rodríguez

Jesús Rodríguez Rodríguez is a frontend developer who dedicates his time to moderate the official Angular.js IRC channel and he also gives support there.

He spent some time collaborating with organization like AngularUI and he also write in his blog (http://www.angular-tips.com) all about angular.

He also likes to edit / review books, that also includes writing his own books.

Packages

The Book

The book in pdf, epub, mobi. The source code is available at https://github.com/survivejs/webpack.

Includes:

  • extras
    Cheatsheet

    Cheatsheet covering webpack's core ideas.

  • extras
    QA with Tobias Koppers, the creator of the tool

    This brief document (30+) pages contains QA (questions/answers) with Tobias Koppers, the creator of the tool. Read it to gain more insight into webpack and where it's going.

  • extras
    Posters

    Posters covering webpack's core ideas. Print in A3 for the best result.

  • PDF

  • EPUB

  • WEB

  • English

$19.99
Minimum price
$19.99
Suggested price
One for a friend too

Get a copy for a friend as well. Includes two copies.

Includes:

  • extras
    Cheatsheet

    Cheatsheet covering webpack's core ideas.

  • extras
    QA with Tobias Koppers, the creator of the tool

    This brief document (30+) pages contains QA (questions/answers) with Tobias Koppers, the creator of the tool. Read it to gain more insight into webpack and where it's going.

  • extras
    Posters

    Posters covering webpack's core ideas. Print in A3 for the best result.

  • PDF

  • EPUB

  • WEB

  • English

$33.99
Minimum price
$33.99
Suggested price
One for the team

Get copies for your team mates. Or friends. I don't discriminate. Includes four copies.

Includes:

  • extras
    Cheatsheet

    Cheatsheet covering webpack's core ideas.

  • extras
    QA with Tobias Koppers, the creator of the tool

    This brief document (30+) pages contains QA (questions/answers) with Tobias Koppers, the creator of the tool. Read it to gain more insight into webpack and where it's going.

  • extras
    Posters

    Posters covering webpack's core ideas. Print in A3 for the best result.

  • PDF

  • EPUB

  • WEB

  • English

$63.99
Minimum price
$63.99
Suggested price

Bundles that include this book

$35.98
Bought separately
$28.99
Bundle Price
$50.97
Bought separately
$34.99
Bundle Price

Reader Testimonials

Gavin Doughtie (Senior Software Engineer, Google)
Gavin Doughtie (Senior Software Engineer, Google)

Before I worked through the SurviveJS Webpack book, my own Webpack config, cobbled together from random code on the Internet, was a mystery to me. Afterwards, I have route-splitting and parallel-loading superpowers.

Clément Paris (Front-End Engineer)
Clément Paris (Front-End Engineer)

After weeks failing at configuring webpack, I stumbled upon SurviveJS book while looking for yet another tutorial. Since that day, it has been my go-to resource for every single webpack question I ever had.

Andrea Chiumenti (CEO, Red Software Systems)
Andrea Chiumenti (CEO, Red Software Systems)

Brilliant! A must have if you want to to learn Webpack but also if need an updated reference guide. I always use it as a reference guide when I develop.

Neeraj Singh (Founder of BigBinary)
Neeraj Singh (Founder of BigBinary)

Practical tips on Webpack

Webpack is powerful but configuring it can be painful. Same goes with React. There are so many ways of configuring React with asset compilation, minification etc that it is easy to get lost. This book provides practical tips on how to proceed.

Stefan Frede (Developer)
Stefan Frede (Developer)

This book is an invaluable resource if you start working with Webpack!

Aaron Harris (Software Engineer)
Aaron Harris (Software Engineer)

This guide was a great starter in taming the Wild West of ESNext-era JavaScript development. It's beauty comes from its commitment to not skipping the fundamentals in favor of a fast demo, but making sure you're understanding what you're doing as you bootstrap your next JavaScript-based UI project.

Julien Castelain (Software Engineer, Liferay)
Julien Castelain (Software Engineer, Liferay)

This guide is a great way to get started with webpack or improve your existing skills

After a detailed introduction, you'll start working on a webpack project that provides all you need to push your app to production. Highly recommended.

Table of Contents

  •  
    • Foreword
    • Preface
    • Introduction
      • What is webpack
      • How webpack changes the situation
      • What will you learn
      • How is the book organized
      • Who is the book for
      • What are the book conventions
      • How is the book versioned
      • How to get support
      • Where to find additional material
      • Acknowledgments
    • What is Webpack
      • Webpack relies on modules
      • Webpack’s execution process
      • Webpack is configuration driven
      • Hot Module Replacement
      • Asset hashing
      • Code splitting
      • Webpack 5
      • Conclusion
  • I Developing
    • 1. Getting Started
      • 1.1 Setting up the project
      • 1.2 Installing webpack
      • 1.3 Running webpack
      • 1.4 Setting up assets
      • 1.5 Configuring mini-html-webpack-plugin
      • 1.6 Examining the output
      • 1.7 Adding a build shortcut
      • 1.8 Conclusion
    • 2. Development Server
      • 2.1 Webpack watch mode
      • 2.2 webpack-dev-server
      • 2.3 webpack-plugin-serve
      • 2.4 Accessing development server from the network
      • 2.5 Polling instead of watching files
      • 2.6 Making it faster to develop webpack configuration
      • 2.7 Watching files outside of webpack’s module graph
      • 2.8 Conclusion
    • 3. Composing Configuration
      • 3.1 Possible ways to manage configuration
      • 3.2 Composing configuration by merging
      • 3.3 Setting up webpack-merge
      • 3.4 Benefits of composing configuration
      • 3.5 Configuration layouts
      • 3.6 Conclusion
  • II Styling
    • 4. Loading Styles
      • 4.1 Loading CSS
      • 4.2 Setting up initial CSS
      • 4.3 PostCSS
      • 4.4 Using CSS preprocessors
      • 4.5 Understanding css-loader lookups
      • 4.6 Conclusion
    • 5. Separating CSS
      • 5.1 Setting up MiniCssExtractPlugin
      • 5.2 Managing styles outside of JavaScript
      • 5.3 Conclusion
    • 6. Eliminating Unused CSS
      • 6.1 Setting up Tailwind
      • 6.2 Enabling PurgeCSS
      • 6.3 Conclusion
    • 7. Autoprefixing
      • 7.1 Setting up autoprefixing
      • 7.2 Defining a browserslist
      • 7.3 Conclusion
  • III Loading Assets
    • 8. Loader Definitions
      • 8.1 Anatomy of a loader
      • 8.2 Loader evaluation order
      • 8.3 Passing parameters to a loader
      • 8.4 Inline definitions
      • 8.5 Branching at use using a function
      • 8.6 Loading with info object
      • 8.7 Loading based on resourceQuery
      • 8.8 Loading based on issuer
      • 8.9 Alternate ways to match files
      • 8.10 Understanding loader behavior
      • 8.11 Conclusion
    • 9. Loading Images
      • 9.1 Integrating images to the project
      • 9.2 Using srcsets
      • 9.3 Optimizing images
      • 9.4 Loading SVGs
      • 9.5 Loading images dynamically
      • 9.6 Loading sprites
      • 9.7 Using placeholders
      • 9.8 Referencing to images
      • 9.9 Conclusion
    • 10. Loading Fonts
      • 10.1 Setting up a loader
      • 10.2 Using icon fonts
      • 10.3 Using Google Fonts
      • 10.4 Manipulating file-loader output path and publicPath
      • 10.5 Eliminating unused characters
      • 10.6 Generating font files based on SVGs
      • 10.7 Conclusion
    • 11. Loading JavaScript
      • 11.1 Using Babel with webpack configuration
      • 11.2 Polyfilling features
      • 11.3 Babel tips
      • 11.4 Babel plugins
      • 11.5 Generating differential builds
      • 11.6 TypeScript
      • 11.7 WebAssembly
      • 11.8 Conclusion
  • IV Building
    • 12. Source Maps
      • 12.1 Inline source maps and separate source maps
      • 12.2 Enabling source maps
      • 12.3 Source map types supported by webpack
      • 12.4 Inline source map types
      • 12.5 Separate source map types
      • 12.6 Other source map options
      • 12.7 SourceMapDevToolPlugin and EvalSourceMapDevToolPlugin
      • 12.8 Changing source map prefix
      • 12.9 Extracting source from source maps
      • 12.10 Source maps on backend
      • 12.11 Ignoring source map related warnings
      • 12.12 Using dependency source maps
      • 12.13 Conclusion
    • 13. Code Splitting
      • 13.1 Code splitting formats
      • 13.2 Controlling code splitting on runtime
      • 13.3 Code splitting in React
      • 13.4 Disabling code splitting
      • 13.5 Machine learning driven prefetching
      • 13.6 Conclusion
    • 14. Bundle Splitting
      • 14.1 Adding something to split
      • 14.2 Setting up a vendor bundle
      • 14.3 Controlling bundle splitting
      • 14.4 Splitting and merging chunks
      • 14.5 Bundle splitting at entry configuration
      • 14.6 Chunk types in webpack
      • 14.7 Conclusion
    • 15. Tidying Up
      • 15.1 Cleaning the build directory
      • 15.2 Attaching a revision to the build
      • 15.3 Copying files
      • 15.4 Conclusion
  • V Optimizing
    • 16. Minifying
      • 16.1 Minifying JavaScript
      • 16.2 Speeding up JavaScript execution
      • 16.3 Minifying HTML
      • 16.4 Minifying CSS
      • 16.5 Compressing bundles
      • 16.6 Obfuscating output
      • 16.7 Conclusion
    • 17. Tree Shaking
      • 17.1 Demonstrating tree shaking
      • 17.2 Tree shaking on package level
      • 17.3 Tree shaking with external packages
      • 17.4 Conclusion
    • 18. Environment Variables
      • 18.1 The basic idea of DefinePlugin
      • 18.2 Setting process.env.NODE_ENV
      • 18.3 Choosing which module to use
      • 18.4 Conclusion
    • 19. Adding Hashes to Filenames
      • 19.1 Placeholders
      • 19.2 Setting up hashing
      • 19.3 Conclusion
    • 20. Separating a Runtime
      • 20.1 Extracting a runtime
      • 20.2 Using records
      • 20.3 Integrating with asset pipelines
      • 20.4 Conclusion
    • 21. Build Analysis
      • 21.1 Configuring webpack
      • 21.2 Enabling a performance budget
      • 21.3 Dependency analysis
      • 21.4 Composition analysis
      • 21.5 Output plugins
      • 21.6 Online services
      • 21.7 Bundle comparison
      • 21.8 Unused files analysis
      • 21.9 Duplication analysis
      • 21.10 Understanding why a module was bundled
      • 21.11 Conclusion
    • 22. Performance
      • 22.1 Measuring impact
      • 22.2 High-level optimizations
      • 22.3 Low-level optimizations
      • 22.4 Optimizing rebundling speed during development
      • 22.5 Webpack 4 performance tricks
      • 22.6 Conclusion
  • VI Output
    • 23. Build Targets
      • 23.1 Web targets
      • 23.2 Node targets
      • 23.3 Desktop targets
      • 23.4 Conclusion
    • 24. Multiple Pages
      • 24.1 Possible approaches
      • 24.2 Generating multiple pages
      • 24.3 Progressive web applications
      • 24.4 Conclusion
    • 25. Server-Side Rendering
      • 25.1 Setting up Babel with React
      • 25.2 Setting up a React demo
      • 25.3 Configuring webpack
      • 25.4 Setting up a server
      • 25.5 Open questions
      • 25.6 Prerendering
      • 25.7 Conclusion
    • 26. Module Federation
      • 26.1 Module federation example
      • 26.2 Adding webpack configuration
      • 26.3 Implementing the application with React
      • 26.4 Separating bootstrap
      • 26.5 Separating header
      • 26.6 Pros and cons
      • 26.7 Learn more
      • 26.8 Conclusion
  • VII Techniques
    • 27. Dynamic Loading
      • 27.1 Dynamic loading with require.context
      • 27.2 Dynamic paths with a dynamic import
      • 27.3 Combining multiple require.contexts
      • 27.4 Dealing with dynamic paths
      • 27.5 Conclusion
    • 28. Web Workers
      • 28.1 Setting up a worker
      • 28.2 Setting up a host
      • 28.3 Sharing data
      • 28.4 Other options
      • 28.5 Conclusion
    • 29. Internationalization
      • 29.1 i18n with webpack
      • 29.2 Setting up translations
      • 29.3 Setting up webpack
      • 29.4 Setting up application
      • 29.5 Conclusion
    • 30. Testing
      • 30.1 Jest
      • 30.2 Mocking
      • 30.3 Removing files from tests
      • 30.4 Conclusion
    • 31. Deploying Applications
      • 31.1 Deploying with gh-pages
      • 31.2 Deploying to other environments
      • 31.3 Resolving output.publicPath dynamically
      • 31.4 Conclusion
    • 32. Consuming Packages
      • 32.1 resolve.alias
      • 32.2 resolve.modules
      • 32.3 resolve.extensions
      • 32.4 resolve.plugins
      • 32.5 Consuming packages outside of webpack
      • 32.6 Dealing with globals
      • 32.7 Managing symbolic links
      • 32.8 Removing unused modules
      • 32.9 Managing pre-built dependencies
      • 32.10 Getting insights on packages
      • 32.11 Conclusion
  • VIII Extending
    • 33. Extending with Loaders
      • 33.1 Debugging loaders with loader-runner
      • 33.2 Implementing an asynchronous loader
      • 33.3 Returning only output
      • 33.4 Writing files
      • 33.5 Passing options to loaders
      • 33.6 Connecting custom loaders with webpack
      • 33.7 Pitch loaders
      • 33.8 Caching with loaders
      • 33.9 Conclusion
    • 34. Extending with Plugins
      • 34.1 The basic flow of webpack plugins
      • 34.2 Setting up a development environment
      • 34.3 Implementing a basic plugin
      • 34.4 Capturing options
      • 34.5 Understanding compiler and compilation
      • 34.6 Writing files through compilation
      • 34.7 Managing warnings and errors
      • 34.8 Plugins can have plugins
      • 34.9 Conclusion
  • Conclusion
    •  
      • General checklist
      • Development checklist
      • Production checklist
      • Conclusion
  • Appendices
    • Comparison of Build Tools
      • Task runners
      • Script loaders
      • Bundlers
      • Zero configuration bundlers
      • Other Options
      • Conclusion
    • Hot Module Replacement
      • Enabling HMR
      • Implementing the HMR interface
      • Setting WDS entry points manually
      • HMR and dynamic loading
      • Conclusion
    • CSS Modules
      • CSS Modules through css-loader
      • Using CSS Modules with third-party libraries and CSS
      • Conclusion
    • Searching with React
      • Implementing search with code splitting
      • Conclusion
    • Troubleshooting
      • Module related errors
      • DeprecationWarning
      • Conclusion
    • Glossary

The Leanpub 60 Day 100% Happiness Guarantee

Within 60 days of purchase you can get a 100% refund on any Leanpub purchase, in two clicks.

Now, this is technically risky for us, since you'll have the book or course files either way. But we're so confident in our products and services, and in our authors and readers, that we're happy to offer a full money back guarantee for everything we sell.

You can only find out how good something is by trying it, and because of our 100% money back guarantee there's literally no risk to do so!

So, there's no reason not to click the Add to Cart button, is there?

See full terms...

80% Royalties. Earn $16 on a $20 book.

We pay 80% royalties. That's not a typo: you earn $16 on a $20 sale. If we sell 5000 non-refunded copies of your book or course for $20, you'll earn $80,000.

(Yes, some authors have already earned much more than that on Leanpub.)

In fact, authors have earnedover $13 millionwriting, publishing and selling on Leanpub.

Learn more about writing on Leanpub

Free Updates. DRM Free.

If you buy a Leanpub book, you get free updates for as long as the author updates the book! Many authors use Leanpub to publish their books in-progress, while they are writing them. All readers get free updates, regardless of when they bought the book or how much they paid (including free).

Most Leanpub books are available in PDF (for computers) and EPUB (for phones, tablets and Kindle). The formats that a book includes are shown at the top right corner of this page.

Finally, Leanpub books don't have any DRM copy-protection nonsense, so you can easily read them on any supported device.

Learn more about Leanpub's ebook formats and where to read them

Write and Publish on Leanpub

You can use Leanpub to easily write, publish and sell in-progress and completed ebooks and online courses!

Leanpub is a powerful platform for serious authors, combining a simple, elegant writing and publishing workflow with a store focused on selling in-progress ebooks.

Leanpub is a magical typewriter for authors: just write in plain text, and to publish your ebook, just click a button. (Or, if you are producing your ebook your own way, you can even upload your own PDF and/or EPUB files and then publish with one click!) It really is that easy.

Learn more about writing on Leanpub