GithubHelp home page GithubHelp logo

pldg / learn-webpack Goto Github PK

View Code? Open in Web Editor NEW
36.0 2.0 6.0 1.72 MB

A collection of simple examples to explain how to configure Webpack

JavaScript 73.04% HTML 20.82% CSS 6.15%
webpack bundler module-bundler build-tool javascript nodejs

learn-webpack's Introduction

Learn Webpack

A collection of simple Webpack examples:

  • Mode: Enable webpack built-in optimizations for development and production.
  • Multiple Configurations: Use --env flag to create different config based on the environment.
  • Bundle: Merge multiple javascripts files.
  • Separate Runtime: Extract webpack runtime logic in a separate file.
  • Tree Shaking: Remove unused javascript codes from the app.
  • Chunks Types: Explain what a webpack chunk is.
  • Dynamic Import: Use import() to load part of an app on demand.
  • Code Splitting: Divide an app into smaller files.
  • Loaders and Plugins: Explain what webpack loaders and plugins are.
  • Asset Modules: Import additional type of assets without configuring loaders.
  • Babel: Use babel-loader to transpile ES2015 code into into a backwards compatible version of javascript.
  • Babel Polyfill: Apply pollyfills to provide a backwards compatible version of a javascript feature.
  • Html Plugin Template: Generate html files with html-webpack-plugin.
  • Load CSS: Use css-loader and style-loader to parse stylesheets and place them into html page.
  • Source Maps: Emit javascript and css source maps.
  • Public Path: Specify a base path for all the assets within your applicaion.
  • Separate CSS: Use mini-css-extract-plugin to extract stylesheets into a separate file.
  • Remove Unused CSS: Use purgecss to remove unused part of stylesheets.
  • Load Images: Use asset/resource to parse and emit images and asset/source to parse raw svg files.
  • SASS: Load sass files with sass-loader.
  • PostCSS: Enable postcss with postcss-loader.
  • Minify: Enable code minification by using mode.production, css-minimizer-webpack-plugin and HtmlWebpackPlugin.minify.
  • Caching: Setup client level caching by adding hash to filenames.
  • Context Module: Run require.context() at compile time to import assets.
  • Debug Webpack: Debug webpack configuration using nodejs --inspect tool.
  • Lazy Load Image: Dynamically import an image with import().
  • Lazy Load Multiple Images: Use require.context() to include all images from a folder and dynamically load them with import().
  • Lazy Load Multiple Images Folders: Dynamically import images inside multiple folders when a button is clicked.
  • Composing Configurations: Organize webpack configs in separate files and merge them with webpack-merge.
  • Static Site Generator: Create a simple SSG on top of HtmlWebpackPlugin.

learn-webpack's People

Contributors

dependabot[bot] avatar pldg avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.