webpack/examples
github-actions[bot] edadb214ba
docs: update examples (#20259)
2025-12-21 22:04:11 +03:00
..
aggressive-merging docs: update examples (#20233) 2025-12-14 15:34:06 +03:00
asset
asset-svg-data-uri
build-http docs: update examples (#20233) 2025-12-14 15:34:06 +03:00
chunkhash
cjs-tree-shaking docs: update examples (#20233) 2025-12-14 15:34:06 +03:00
code-splitted-require.context
code-splitted-require.context-amd
code-splitting docs: update examples (#20233) 2025-12-14 15:34:06 +03:00
code-splitting-bundle-loader
code-splitting-depend-on-advanced docs: update examples (#20233) 2025-12-14 15:34:06 +03:00
code-splitting-depend-on-simple
code-splitting-harmony
code-splitting-native-import-context docs: update examples (#20233) 2025-12-14 15:34:06 +03:00
code-splitting-native-import-context-filter
code-splitting-specify-chunk-name docs: update examples (#20233) 2025-12-14 15:34:06 +03:00
coffee-script
common-chunk-and-vendor-chunk
common-chunk-grandchildren
commonjs
css
custom-javascript-parser
custom-json-modules docs: update examples (#20233) 2025-12-14 15:34:06 +03:00
dll docs: update examples (#20233) 2025-12-14 15:34:06 +03:00
dll-app-and-vendor docs: update examples (#20233) 2025-12-14 15:34:06 +03:00
dll-entry-only
dll-user
dotenv
explicit-vendor-chunk docs: update examples (#20233) 2025-12-14 15:34:06 +03:00
externals
extra-async-chunk docs: update examples (#20233) 2025-12-14 15:34:06 +03:00
extra-async-chunk-advanced
harmony docs: update examples (#20233) 2025-12-14 15:34:06 +03:00
harmony-interop
harmony-library refactor: examples (#20085) 2025-11-04 18:22:51 +03:00
harmony-unused
http2-aggressive-splitting
hybrid-routing docs: update examples (#20233) 2025-12-14 15:34:06 +03:00
lazy-compilation refactor: examples (#20085) 2025-11-04 18:22:51 +03:00
loader docs: update examples (#20233) 2025-12-14 15:34:06 +03:00
manifest-plugin
many-pages docs: update examples (#20192) 2025-12-01 19:52:19 +03:00
mixed docs: update examples (#20233) 2025-12-14 15:34:06 +03:00
module refactor: examples (#20085) 2025-11-04 18:22:51 +03:00
module-code-splitting
module-federation
module-library refactor: examples (#20085) 2025-11-04 18:22:51 +03:00
module-worker docs: update examples (#20233) 2025-12-14 15:34:06 +03:00
multi-compiler docs: update examples (#20233) 2025-12-14 15:34:06 +03:00
multi-part-library docs: update examples (#20233) 2025-12-14 15:34:06 +03:00
multiple-entry-points
named-chunks
node_modules
nodejs-addons
persistent-caching
reexport-components
require.context docs: update examples (#20233) 2025-12-14 15:34:06 +03:00
require.resolve
scope-hoisting docs: update examples (#20233) 2025-12-14 15:34:06 +03:00
side-effects docs: update examples (#20233) 2025-12-14 15:34:06 +03:00
source-map
source-mapping-url
stats-detailed
stats-minimal
stats-none refactor: examples (#20085) 2025-11-04 18:22:51 +03:00
stats-normal
stats-summary refactor: examples (#20085) 2025-11-04 18:22:51 +03:00
top-level-await
two-explicit-vendor-chunks docs: update examples (#20233) 2025-12-14 15:34:06 +03:00
typescript docs: update examples (#20233) 2025-12-14 15:34:06 +03:00
virtual-modules
wasm-bindgen-esm
wasm-complex
wasm-simple docs: update examples (#20233) 2025-12-14 15:34:06 +03:00
worker
README.md
build-common.js
buildAll.js
examples.js
template-common.js

README.md

Examples

Table of Contents

  1. Aggressive Merging
  2. Chunk
  3. Code Splitted
  4. Code Splitting
  5. Coffee Script
  6. CommonJS
  7. DLL
  8. Externals
  9. Harmony
  10. HTTP2 Aggressive Splitting
  11. Hybrid Routing
  12. Loader
  13. Mixed
  14. Multi Compiler
  15. Multi Part Library
  16. Multiple Entry Points
  17. Require Context
  18. Require Resolve
  19. Scope Hoisting
  20. Side Effects
  21. Source Map
  22. WebAssembly
  23. Web Worker
  24. Requests
  25. Building an Example

Aggressive Merging

aggressive-merging

Chunk

chunkhash

common-chunk-and-vendor-chunk

explicit-vendor-chunk

extra-async-chunk-advanced

extra-async-chunk

code-splitting-specify-chunk-name

named-chunks example demonstrating merging of chunks with named chunks

two-explicit-vendor-chunks

Code Splitted

code-splitted-require.context-amd example demonstrating contexts in a code-split environment with AMD.

code-splitted-require.context example demonstrating contexts in a code-split environment.

Code Splitting

code-splitting example demonstrating a very simple case of Code Splitting.

code-splitting-bundle-loader example demonstrating Code Splitting through the bundle loader

code-splitting-harmony

code-splitting-native-import-context

code-splitting-specify-chunk-name

Coffee Script

coffee-script example demonstrating code written in coffee-script.

CommonJS

commonjs example demonstrating a very simple program

DLL

dll

dll-user

Externals

externals

Harmony

harmony

code-splitting-harmony

harmony-interop

harmony-library

harmony-unused

HTTP2 Aggressive Splitting

http2-aggressive-splitting

Hybrid Routing

hybrid-routing

Loader

loader example demonstrating the usage of loaders.

Mixed

mixed example demonstrating mixing CommonJs and AMD

Multi Compiler

multi-compiler

Multi Part Library

multi-part-library

Multiple Entry Points

multiple-entry-points example demonstrating multiple entry points with Code Splitting.

Require Context

require.context example demonstrating automatic creation of contexts when using variables in require.

Require Resolve

require.resolve example demonstrating how to cache clearing of modules with require.resolve and require.cache.

Scope Hoisting

scope-hoisting

Side Effects

side-effects

TypeScript

TypeScript

Source Map

source-map

WebAssembly

wasm-simple example demonstrating simple import from a WebAssembly module wasm-complex example demonstrating top-level await and import of WebAssembly text format with wast-loader

Web Worker

web-worker example demonstrating creating WebWorkers with webpack.

Requests

If you think an example is missing, please report it as issue. :)

Building an Example

  1. Run yarn in the root of the project.
  2. Run yarn setup in the root of the project.
  3. Run yarn add --dev webpack-cli in the root of the project.
  4. Run node build.js in the specific example directory. (Ex: cd examples/commonjs && node build.js)

Note: To build all examples run npm run build:examples