webpack/examples
Tobias Speicher 8f56fcba72
Replace deprecated String.prototype.substr()
String.prototype.substr() is deprecated (see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/substr) so we replace it with slice() which works similarily but isn't deprecated.
Signed-off-by: Tobias Speicher <rootcommander@gmail.com>
2022-03-13 22:54:18 +01:00
..
aggressive-merging update examples 2021-08-20 08:12:50 +02:00
asset-advanced update examples 2021-08-20 08:12:50 +02:00
asset-simple update examples 2021-08-20 08:12:50 +02:00
build-http improve buildHttp 2021-10-19 09:21:05 +02:00
chunkhash update examples 2021-08-20 08:12:50 +02:00
cjs-tree-shaking update examples 2021-08-20 08:12:50 +02:00
code-splitted-require.context update examples 2021-08-20 08:12:50 +02:00
code-splitted-require.context-amd update examples 2021-08-20 08:12:50 +02:00
code-splitting update examples 2021-08-20 08:12:50 +02:00
code-splitting-bundle-loader update examples 2021-08-20 08:12:50 +02:00
code-splitting-depend-on-advanced update examples 2021-08-20 08:12:50 +02:00
code-splitting-depend-on-simple update examples 2021-08-20 08:12:50 +02:00
code-splitting-harmony update examples 2021-08-20 08:12:50 +02:00
code-splitting-native-import-context update examples 2021-08-20 08:12:50 +02:00
code-splitting-native-import-context-filter update examples 2021-08-20 08:12:50 +02:00
code-splitting-specify-chunk-name update examples 2021-08-20 08:12:50 +02:00
coffee-script update examples 2021-08-20 08:12:50 +02:00
common-chunk-and-vendor-chunk update examples 2021-08-20 08:12:50 +02:00
common-chunk-grandchildren update examples 2021-08-20 08:12:50 +02:00
commonjs update examples 2021-08-20 08:12:50 +02:00
css fix css hmr edge cases 2022-01-14 11:11:06 +01:00
custom-json-modules update examples 2021-08-20 08:12:50 +02:00
dll update examples 2021-08-20 08:12:50 +02:00
dll-app-and-vendor update examples 2021-08-20 08:12:50 +02:00
dll-entry-only update examples 2021-08-20 08:12:50 +02:00
dll-user update examples 2021-08-20 08:12:50 +02:00
explicit-vendor-chunk update examples 2021-08-20 08:12:50 +02:00
externals update examples 2021-08-20 08:12:50 +02:00
extra-async-chunk update examples 2021-08-20 08:12:50 +02:00
extra-async-chunk-advanced update examples 2021-08-20 08:12:50 +02:00
harmony update examples 2021-08-20 08:12:50 +02:00
harmony-interop update examples 2021-08-20 08:12:50 +02:00
harmony-library update examples 2021-08-20 08:12:50 +02:00
harmony-unused update examples 2021-08-20 08:12:50 +02:00
http2-aggressive-splitting update examples 2021-08-20 08:12:50 +02:00
hybrid-routing update examples 2021-08-20 08:12:50 +02:00
lazy-compilation update lazy-compilation example for webpack-dev-server@4 2021-08-19 11:00:31 +02:00
loader update examples 2021-08-20 08:12:50 +02:00
many-pages update examples 2021-08-20 08:12:50 +02:00
mixed update examples 2021-08-20 08:12:50 +02:00
module update examples 2021-08-20 08:12:50 +02:00
module-code-splitting update examples 2021-08-20 08:12:50 +02:00
module-federation chore: update cSpell globs and fix typos 2021-12-12 16:57:14 -05:00
module-library update examples 2021-08-20 08:12:50 +02:00
module-worker update examples 2021-08-20 08:12:50 +02:00
multi-compiler update examples 2021-08-20 08:12:50 +02:00
multi-part-library update examples 2021-08-20 08:12:50 +02:00
multiple-entry-points update examples 2021-08-20 08:12:50 +02:00
named-chunks update examples 2021-08-20 08:12:50 +02:00
node_modules added dll example with module 2015-10-13 16:19:11 +02:00
persistent-caching update examples 2021-08-20 08:12:50 +02:00
reexport-components update examples 2021-08-20 08:12:50 +02:00
require.context update examples 2021-08-20 08:12:50 +02:00
require.resolve update examples 2021-08-20 08:12:50 +02:00
scope-hoisting update examples 2021-08-20 08:12:50 +02:00
side-effects update examples 2021-08-20 08:12:50 +02:00
source-map update examples 2021-08-20 08:12:50 +02:00
top-level-await update examples 2021-08-20 08:12:50 +02:00
two-explicit-vendor-chunks update examples 2021-08-20 08:12:50 +02:00
typescript update examples 2021-08-20 08:12:50 +02:00
wasm-complex update examples 2021-08-20 08:12:50 +02:00
wasm-simple update examples 2021-08-20 08:12:50 +02:00
worker update examples 2021-08-20 08:12:50 +02:00
README.md doc: add wasm examples to ToC 2021-06-18 11:24:37 +00:00
build-common.js upgrade examples to webpack-cli major 4 2020-12-28 23:29:41 +01:00
buildAll.js upgrade examples to webpack-cli major 4 2020-12-28 23:29:41 +01:00
examples.js Refactor example scripts and test to allow nested folders 2017-07-27 13:24:56 +02:00
template-common.js Replace deprecated String.prototype.substr() 2022-03-13 22:54:18 +01:00

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-css-bundle

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 builder 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