Class Central is learner-supported. When you buy through links on our site, we may earn an affiliate commission.

SymfonyCasts

JavaScript for PHP Geeks: Webpack for Module Loading Awesomeness

via SymfonyCasts

Overview

Tip

This tutorial covers Webpack 3 But don't worry! The vast majority of the concepts are still the same. So, if you want to learn Webpack & module loading, you're still in the right place. The biggest differences are in the CommonsChunkPlugin area.

In JavaScript, if you're still manually including each JavaScript file you depend on with a script tag... there's a better way! ES6 introduced the concept of modules: the ability (finally!) to isolate our JavaScript into small components that live in different files (like we do with classes in JavaScript).

But, to get this to work on the web, we need some help. We need something that's able to read our imports and aggregate everything we need into a single JavaScript file. We need webpack:

  • Using npm... and then yarn for package management
  • Webpack setup: package all modules into a single file
  • Calling Babel from webpack via a loader
  • Webpack dev tools for fast development
  • Webpack Hot Reloading!?
  • Handling multiple files ("entry points")
  • Using Uglify and prepping for production
  • Cache-busting with hashed filenames
  • CommonsChunkPlugin: package common modules together
  • Loading & Packaging CSS/SCSS & images form JavaScript!?

And most importantly: become empowered to (finally) write organized JavaScript!

Syllabus

  • The Power of require
  • Your First Webpack
  • webpack.config.js
  • watch + Install jQuery with Yarn
  • Requiring SweetAlert2
  • Modularize our Code
  • Multiple Entries / Pages
  • Legacy Libraries & global jQuery
  • ProvidePlugin & Global Vars
  • babel-loader
  • babel-loader Options & Polyfill
  • Require CSS Files
  • Images in CSS (file-loader)
  • Bootstrap CSS & Fonts
  • Font Awesome & file-loader [hash]
  • copy-webpack-plugin
  • Sass with sass-loader
  • Bootstrap Sass & resolve-url-loader
  • Tweaking Bootstrap's Sass
  • Sourcemaps & Debugging
  • jQuery & Legacy JS in your Template
  • Passing Server Data to JS
  • FOSJsRoutingBundle
  • Lodash & requiring Partial Libraries
  • ES6 import & export
  • CommonsChunkPlugin: Shared/Vendor Entry
  • Optimizing the "Commons" Chunk
  • webpack-dev-server
  • Hot Module Replacement
  • extract-text-webpack-plugin
  • Production Build
  • Minify CSS & DefinePlugin
  • Versioning & Cache Busting
  • Versioning manifest.json
  • Versioning Optimizations
  • Code Splitting
  • Webpack Visualizer

Taught by

Ryan Weaver and Leanna Pelham

Reviews

Start your review of JavaScript for PHP Geeks: Webpack for Module Loading Awesomeness

Never Stop Learning.

Get personalized course recommendations, track subjects and courses with reminders, and more.

Someone learning on their laptop while sitting on the floor.