webpack/examples/README.md

150 lines
4.2 KiB
Markdown
Raw Permalink Normal View History

2017-06-20 18:42:46 +08:00
# Examples
2019-08-07 00:12:48 +08:00
## Table of Contents
1. [Aggressive Merging](#aggressive-merging)
2. [Chunk](#chunk)
3. [Code Splitted](#code-splitted)
4. [Code Splitting](#code-splitting)
5. [Coffee Script](#coffee-script)
6. [CommonJS](#commonjs)
7. [DLL](#dll)
8. [Externals](#externals)
9. [Harmony](#harmony)
10. [HTTP2 Aggressive Splitting](#http2-aggressive-splitting)
11. [Hybrid Routing](#hybrid-routing)
2021-01-12 09:27:52 +08:00
12. [Loader](#loader)
13. [Mixed](#mixed)
14. [Multi Compiler](#multi-compiler)
15. [Multi Part Library](#multi-part-library)
16. [Multiple Entry Points](#multiple-entry-points)
17. [Require Context](#require-context)
18. [Require Resolve](#require-resolve)
19. [Scope Hoisting](#scope-hoisting)
20. [Side Effects](#side-effects)
21. [Source Map](#source-map)
2021-06-18 19:18:07 +08:00
22. [WebAssembly](#webassembly)
23. [Web Worker](#web-worker)
24. [Requests](#requests)
25. [Building an Example](#building-an-example)
2019-08-07 00:12:48 +08:00
2017-06-20 18:42:46 +08:00
## Aggressive Merging
[aggressive-merging](aggressive-merging)
2012-04-06 18:40:43 +08:00
2017-06-20 18:42:46 +08:00
## Chunk
[chunkhash](chunkhash)
2012-05-07 03:14:36 +08:00
2017-06-20 18:42:46 +08:00
[common-chunk-and-vendor-chunk](common-chunk-and-vendor-chunk)
2012-05-07 03:14:36 +08:00
2017-06-20 18:42:46 +08:00
[explicit-vendor-chunk](explicit-vendor-chunk)
2012-04-06 18:40:43 +08:00
2017-06-20 18:42:46 +08:00
[extra-async-chunk-advanced](extra-async-chunk-advanced)
2012-04-06 18:40:43 +08:00
2017-06-20 18:42:46 +08:00
[extra-async-chunk](extra-async-chunk)
2012-07-19 17:48:07 +08:00
2017-06-20 18:42:46 +08:00
[code-splitting-specify-chunk-name](code-splitting-specify-chunk-name)
2012-07-19 17:48:07 +08:00
[named-chunks](named-chunks) example demonstrating merging of chunks with named chunks
2012-04-06 18:40:43 +08:00
2017-06-20 18:42:46 +08:00
[two-explicit-vendor-chunks](two-explicit-vendor-chunks)
2012-08-23 07:58:17 +08:00
2017-06-20 18:42:46 +08:00
## Code Splitted
[code-splitted-require.context-amd](code-splitted-require.context-amd) example demonstrating contexts in a code-split environment with AMD.
2012-04-06 18:40:43 +08:00
2017-06-20 18:42:46 +08:00
[code-splitted-require.context](code-splitted-require.context) example demonstrating contexts in a code-split environment.
2012-04-06 18:40:43 +08:00
2017-06-20 18:42:46 +08:00
## Code Splitting
[code-splitting](code-splitting) example demonstrating a very simple case of Code Splitting.
2012-04-06 18:40:43 +08:00
2023-04-08 00:01:53 +08:00
[code-splitting-bundle-loader](code-splitting-bundle-loader) example demonstrating Code Splitting through the bundle loader
2012-04-06 18:40:43 +08:00
[code-splitting-harmony](code-splitting-harmony)
2012-05-07 03:14:36 +08:00
[code-splitting-native-import-context](code-splitting-native-import-context)
2012-05-07 03:14:36 +08:00
2017-06-20 18:42:46 +08:00
[code-splitting-specify-chunk-name](code-splitting-specify-chunk-name)
2012-05-17 18:46:55 +08:00
2017-06-20 18:42:46 +08:00
## Coffee Script
[coffee-script](coffee-script) example demonstrating code written in coffee-script.
2012-05-17 18:46:55 +08:00
2017-06-20 18:42:46 +08:00
## CommonJS
[commonjs](commonjs) example demonstrating a very simple program
2012-08-07 04:19:15 +08:00
2017-06-20 18:42:46 +08:00
## DLL
[dll](dll)
2012-08-23 07:58:17 +08:00
2017-06-20 18:42:46 +08:00
[dll-user](dll-user)
2017-06-20 18:42:46 +08:00
## Externals
[externals](externals)
2017-06-20 18:42:46 +08:00
## Harmony
[harmony](harmony)
2013-11-20 01:09:26 +08:00
2017-06-20 18:42:46 +08:00
[code-splitting-harmony](code-splitting-harmony)
2013-11-20 01:09:26 +08:00
2017-06-20 18:42:46 +08:00
[harmony-interop](harmony-interop)
[harmony-library](harmony-library)
[harmony-unused](harmony-unused)
2017-09-01 10:11:06 +08:00
## HTTP2 Aggressive Splitting
2017-06-20 18:42:46 +08:00
[http2-aggressive-splitting](http2-aggressive-splitting)
## Hybrid Routing
[hybrid-routing](hybrid-routing)
## Loader
[loader](loader) example demonstrating the usage of loaders.
## Mixed
[mixed](mixed) example demonstrating mixing CommonJs and AMD
## Multi Compiler
[multi-compiler](multi-compiler)
## Multi Part Library
[multi-part-library](multi-part-library)
2012-04-06 18:40:43 +08:00
2017-06-20 18:42:46 +08:00
## Multiple Entry Points
[multiple-entry-points](multiple-entry-points) example demonstrating multiple entry points with Code Splitting.
## Require Context
[require.context](require.context) example demonstrating automatic creation of contexts when using variables in `require`.
## Require Resolve
[require.resolve](require.resolve) example demonstrating how to cache clearing of modules with `require.resolve` and `require.cache`.
## Scope Hoisting
[scope-hoisting](scope-hoisting)
## Side Effects
[side-effects](side-effects)
2017-08-08 15:40:17 +08:00
## TypeScript
[TypeScript](typescript)
2017-06-20 18:42:46 +08:00
## Source Map
[source-map](source-map)
2021-06-18 19:18:07 +08:00
## WebAssembly
[wasm-simple](wasm-simple) example demonstrating simple import from a WebAssembly module
[wasm-complex](wasm-complex) example demonstrating top-level await and import of WebAssembly text format with wast-loader
2017-06-20 18:42:46 +08:00
## Web Worker
2021-03-18 07:31:19 +08:00
[web-worker](worker) example demonstrating creating WebWorkers with webpack.
2017-06-20 18:42:46 +08:00
# Requests
If you think an example is missing, please report it as issue. :)
2012-04-06 18:40:43 +08:00
# Building an Example
2018-10-29 18:29:06 +08:00
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`