webpack/examples
Alexander Akait f6c3c24da3
feat: added support for import file from "./file.ext" with { type: "bytes" } to get the content as `Uint8Array` (#19928)
2025-09-24 21:01:10 +03:00
..
aggressive-merging docs: update examples (#19831) 2025-08-24 13:55:31 +03:00
asset feat: added support for import file from "./file.ext" with { type: "bytes" } to get the content as `Uint8Array` (#19928) 2025-09-24 21:01:10 +03:00
asset-svg-data-uri feat: added support for import file from "./file.ext" with { type: "bytes" } to get the content as `Uint8Array` (#19928) 2025-09-24 21:01:10 +03:00
build-http docs: update examples (#19663) 2025-07-08 15:46:25 +03:00
chunkhash docs: update examples (#19831) 2025-08-24 13:55:31 +03:00
cjs-tree-shaking refactor: use `eslint-config-webpack` (#19645) 2025-07-02 15:10:54 +03:00
code-splitted-require.context docs: update examples (#19831) 2025-08-24 13:55:31 +03:00
code-splitted-require.context-amd docs: update examples (#19831) 2025-08-24 13:55:31 +03:00
code-splitting docs: update examples (#19831) 2025-08-24 13:55:31 +03:00
code-splitting-bundle-loader docs: update examples (#19831) 2025-08-24 13:55:31 +03:00
code-splitting-depend-on-advanced docs: update examples (#19831) 2025-08-24 13:55:31 +03:00
code-splitting-depend-on-simple docs: update examples (#19663) 2025-07-08 15:46:25 +03:00
code-splitting-harmony docs: update examples (#19831) 2025-08-24 13:55:31 +03:00
code-splitting-native-import-context docs: update examples (#19860) 2025-09-01 16:17:24 +03:00
code-splitting-native-import-context-filter docs: update examples (#19860) 2025-09-01 16:17:24 +03:00
code-splitting-specify-chunk-name docs: update examples (#19923) 2025-09-23 20:28:03 +03:00
coffee-script refactor: use `eslint-config-webpack` (#19645) 2025-07-02 15:10:54 +03:00
common-chunk-and-vendor-chunk docs: update examples (#19663) 2025-07-08 15:46:25 +03:00
common-chunk-grandchildren docs: update examples (#19831) 2025-08-24 13:55:31 +03:00
commonjs
css docs: update examples (#19831) 2025-08-24 13:55:31 +03:00
custom-json-modules docs: update examples (#19663) 2025-07-08 15:46:25 +03:00
dll docs: update examples (#19883) 2025-09-08 15:02:43 +03:00
dll-app-and-vendor
dll-entry-only docs: update examples (#19883) 2025-09-08 15:02:43 +03:00
dll-user docs: update examples (#19883) 2025-09-08 15:02:43 +03:00
explicit-vendor-chunk docs: update examples (#19883) 2025-09-08 15:02:43 +03:00
externals docs: update examples (#19663) 2025-07-08 15:46:25 +03:00
extra-async-chunk docs: update examples (#19831) 2025-08-24 13:55:31 +03:00
extra-async-chunk-advanced docs: update examples (#19831) 2025-08-24 13:55:31 +03:00
harmony docs: update examples (#19831) 2025-08-24 13:55:31 +03:00
harmony-interop
harmony-library docs: update examples (#19663) 2025-07-08 15:46:25 +03:00
harmony-unused refactor: use `eslint-config-webpack` (#19645) 2025-07-02 15:10:54 +03:00
http2-aggressive-splitting docs: update examples (#19883) 2025-09-08 15:02:43 +03:00
hybrid-routing docs: update examples (#19923) 2025-09-23 20:28:03 +03:00
lazy-compilation docs: update examples (#19663) 2025-07-08 15:46:25 +03:00
loader refactor: use `eslint-config-webpack` (#19645) 2025-07-02 15:10:54 +03:00
many-pages docs: update examples (#19663) 2025-07-08 15:46:25 +03:00
mixed docs: update examples (#19831) 2025-08-24 13:55:31 +03:00
module docs: update examples (#19778) 2025-08-11 14:50:37 +03:00
module-code-splitting docs: update examples (#19860) 2025-09-01 16:17:24 +03:00
module-federation docs: update examples (#19831) 2025-08-24 13:55:31 +03:00
module-library docs: update examples (#19778) 2025-08-11 14:50:37 +03:00
module-worker docs: update examples (#19742) 2025-07-28 14:55:53 +03:00
multi-compiler docs: update examples (#19663) 2025-07-08 15:46:25 +03:00
multi-part-library docs: update examples (#19663) 2025-07-08 15:46:25 +03:00
multiple-entry-points docs: update examples (#19831) 2025-08-24 13:55:31 +03:00
named-chunks docs: update examples (#19831) 2025-08-24 13:55:31 +03:00
node_modules
nodejs-addons docs: update examples (#19742) 2025-07-28 14:55:53 +03:00
persistent-caching docs: update examples (#19812) 2025-08-17 18:11:00 +03:00
reexport-components docs: update examples (#19831) 2025-08-24 13:55:31 +03:00
require.context
require.resolve
scope-hoisting docs: update examples (#19923) 2025-09-23 20:28:03 +03:00
side-effects refactor: use `eslint-config-webpack` (#19645) 2025-07-02 15:10:54 +03:00
source-map docs: update examples (#19663) 2025-07-08 15:46:25 +03:00
source-mapping-url docs: update examples (#19883) 2025-09-08 15:02:43 +03:00
stats-detailed docs: update examples (#19883) 2025-09-08 15:02:43 +03:00
stats-minimal docs: update examples (#19663) 2025-07-08 15:46:25 +03:00
stats-none docs: update examples (#19663) 2025-07-08 15:46:25 +03:00
stats-normal docs: update examples (#19663) 2025-07-08 15:46:25 +03:00
stats-summary docs: update examples (#19663) 2025-07-08 15:46:25 +03:00
top-level-await docs: update examples (#19831) 2025-08-24 13:55:31 +03:00
two-explicit-vendor-chunks docs: update examples (#19663) 2025-07-08 15:46:25 +03:00
typescript docs: update examples (#19663) 2025-07-08 15:46:25 +03:00
virtual-modules docs: update examples (#19812) 2025-08-17 18:11:00 +03:00
wasm-bindgen-esm docs: update examples (#19831) 2025-08-24 13:55:31 +03:00
wasm-complex docs: update examples (#19831) 2025-08-24 13:55:31 +03:00
wasm-simple docs: update examples (#19663) 2025-07-08 15:46:25 +03:00
worker docs: update examples (#19923) 2025-09-23 20:28:03 +03:00
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