webpack 1.13.3 → 1.14.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (212) hide show
  1. package/LICENSE +22 -22
  2. package/README.md +310 -310
  3. package/buildin/amd-define.js +1 -1
  4. package/buildin/amd-options.js +1 -1
  5. package/buildin/module.js +10 -10
  6. package/hot/dev-server.js +63 -63
  7. package/hot/log-apply-result.js +25 -25
  8. package/hot/only-dev-server.js +77 -77
  9. package/hot/poll.js +37 -37
  10. package/hot/signal.js +65 -65
  11. package/lib/APIPlugin.js +49 -49
  12. package/lib/AbstractPlugin.js +22 -22
  13. package/lib/AmdMainTemplatePlugin.js +43 -43
  14. package/lib/ArrayMap.js +50 -50
  15. package/lib/AsyncDependenciesBlock.js +39 -39
  16. package/lib/AutomaticPrefetchPlugin.js +35 -35
  17. package/lib/BannerPlugin.js +34 -34
  18. package/lib/BasicEvaluatedExpression.js +140 -140
  19. package/lib/CachePlugin.js +43 -43
  20. package/lib/CaseSensitiveModulesWarning.js +16 -16
  21. package/lib/Chunk.js +252 -252
  22. package/lib/ChunkRenderError.js +17 -17
  23. package/lib/ChunkTemplate.js +37 -37
  24. package/lib/CompatibilityPlugin.js +42 -42
  25. package/lib/Compilation.js +891 -891
  26. package/lib/Compiler.js +407 -407
  27. package/lib/ConcatSource.js +5 -5
  28. package/lib/ConstPlugin.js +54 -54
  29. package/lib/ContextModule.js +130 -130
  30. package/lib/ContextModuleFactory.js +132 -132
  31. package/lib/ContextReplacementPlugin.js +93 -93
  32. package/lib/CriticalDependenciesWarning.js +24 -24
  33. package/lib/DefinePlugin.js +126 -126
  34. package/lib/DelegatedModule.js +69 -69
  35. package/lib/DelegatedModuleFactoryPlugin.js +51 -51
  36. package/lib/DelegatedPlugin.js +21 -21
  37. package/lib/DependenciesBlock.js +57 -57
  38. package/lib/DependenciesBlockVariable.js +41 -41
  39. package/lib/Dependency.js +54 -54
  40. package/lib/DllEntryPlugin.js +32 -32
  41. package/lib/DllModule.js +55 -55
  42. package/lib/DllModuleFactory.js +18 -18
  43. package/lib/DllPlugin.js +30 -30
  44. package/lib/DllReferencePlugin.js +26 -26
  45. package/lib/EntryModuleNotFoundError.js +15 -15
  46. package/lib/EntryOptionPlugin.js +28 -28
  47. package/lib/EnvironmentPlugin.js +28 -28
  48. package/lib/EvalDevToolModulePlugin.js +17 -17
  49. package/lib/EvalDevToolModuleTemplatePlugin.js +29 -29
  50. package/lib/EvalSourceMapDevToolModuleTemplatePlugin.js +68 -68
  51. package/lib/EvalSourceMapDevToolPlugin.js +25 -25
  52. package/lib/ExtendedAPIPlugin.js +45 -45
  53. package/lib/ExternalModule.js +89 -89
  54. package/lib/ExternalModuleFactoryPlugin.js +86 -86
  55. package/lib/ExternalsPlugin.js +16 -16
  56. package/lib/FunctionModulePlugin.js +18 -18
  57. package/lib/FunctionModuleTemplatePlugin.js +39 -39
  58. package/lib/HotModuleReplacement.runtime.js +486 -486
  59. package/lib/HotModuleReplacementPlugin.js +223 -223
  60. package/lib/HotUpdateChunkTemplate.js +28 -28
  61. package/lib/IgnorePlugin.js +32 -32
  62. package/lib/JsonpChunkTemplatePlugin.js +26 -26
  63. package/lib/JsonpExportMainTemplatePlugin.js +28 -28
  64. package/lib/JsonpHotUpdateChunkTemplatePlugin.js +26 -26
  65. package/lib/JsonpMainTemplate.runtime.js +56 -56
  66. package/lib/JsonpMainTemplatePlugin.js +162 -162
  67. package/lib/JsonpTemplatePlugin.js +17 -17
  68. package/lib/LibManifestPlugin.js +49 -49
  69. package/lib/LibraryTemplatePlugin.js +77 -77
  70. package/lib/LoaderTargetPlugin.js +16 -16
  71. package/lib/MainTemplate.js +169 -169
  72. package/lib/MemoryOutputFileSystem.js +5 -5
  73. package/lib/Module.js +116 -116
  74. package/lib/ModuleFilenameHelpers.js +157 -157
  75. package/lib/ModuleNotFoundError.js +17 -17
  76. package/lib/ModuleParseError.js +26 -26
  77. package/lib/ModuleParserHelpers.js +21 -21
  78. package/lib/ModuleReason.js +9 -9
  79. package/lib/ModuleTemplate.js +23 -23
  80. package/lib/MovedToPluginWarningPlugin.js +17 -17
  81. package/lib/MultiCompiler.js +166 -166
  82. package/lib/MultiEntryPlugin.js +31 -31
  83. package/lib/MultiModule.js +71 -71
  84. package/lib/MultiModuleFactory.js +18 -18
  85. package/lib/NamedModulesPlugin.js +21 -21
  86. package/lib/NewWatchingPlugin.js +12 -12
  87. package/lib/NoErrorsPlugin.js +18 -18
  88. package/lib/NodeStuffPlugin.js +99 -99
  89. package/lib/NormalModule.js +322 -322
  90. package/lib/NormalModuleFactory.js +171 -171
  91. package/lib/NormalModuleReplacementPlugin.js +40 -40
  92. package/lib/NullFactory.js +10 -10
  93. package/lib/OldWatchingPlugin.js +14 -14
  94. package/lib/OptionsApply.js +10 -10
  95. package/lib/OriginalSource.js +5 -5
  96. package/lib/Parser.js +938 -938
  97. package/lib/PrefetchPlugin.js +25 -25
  98. package/lib/ProgressPlugin.js +80 -80
  99. package/lib/ProvidePlugin.js +48 -48
  100. package/lib/RawModule.js +65 -65
  101. package/lib/RawSource.js +5 -5
  102. package/lib/RecordIdsPlugin.js +130 -130
  103. package/lib/RequestShortener.js +56 -56
  104. package/lib/RequireJsStuffPlugin.js +38 -38
  105. package/lib/ResolverPlugin.js +34 -34
  106. package/lib/SetVarMainTemplatePlugin.js +36 -36
  107. package/lib/SingleEntryPlugin.js +24 -24
  108. package/lib/Source.js +5 -5
  109. package/lib/SourceMapDevToolModuleOptionsPlugin.js +33 -33
  110. package/lib/SourceMapDevToolPlugin.js +168 -168
  111. package/lib/SourceMapSource.js +5 -5
  112. package/lib/Stats.js +732 -732
  113. package/lib/Template.js +119 -119
  114. package/lib/TemplatedPathPlugin.js +111 -111
  115. package/lib/UmdMainTemplatePlugin.js +146 -146
  116. package/lib/UnsupportedFeatureWarning.js +14 -14
  117. package/lib/WarnCaseSensitiveModulesPlugin.js +27 -27
  118. package/lib/WatchIgnorePlugin.js +45 -45
  119. package/lib/WebpackOptionsApply.js +376 -376
  120. package/lib/WebpackOptionsDefaulter.js +112 -112
  121. package/lib/dependencies/AMDDefineDependency.js +63 -63
  122. package/lib/dependencies/AMDDefineDependencyParserPlugin.js +240 -240
  123. package/lib/dependencies/AMDPlugin.js +115 -115
  124. package/lib/dependencies/AMDRequireArrayDependency.js +34 -34
  125. package/lib/dependencies/AMDRequireContextDependency.js +18 -18
  126. package/lib/dependencies/AMDRequireDependenciesBlock.js +25 -25
  127. package/lib/dependencies/AMDRequireDependenciesBlockParserPlugin.js +145 -145
  128. package/lib/dependencies/AMDRequireDependency.js +64 -64
  129. package/lib/dependencies/AMDRequireItemDependency.js +17 -17
  130. package/lib/dependencies/CommonJsPlugin.js +93 -93
  131. package/lib/dependencies/CommonJsRequireContextDependency.js +18 -18
  132. package/lib/dependencies/CommonJsRequireDependency.js +17 -17
  133. package/lib/dependencies/CommonJsRequireDependencyParserPlugin.js +91 -91
  134. package/lib/dependencies/ConstDependency.js +29 -29
  135. package/lib/dependencies/ContextDependency.js +24 -24
  136. package/lib/dependencies/ContextDependencyHelpers.js +34 -34
  137. package/lib/dependencies/ContextDependencyTemplateAsId.js +22 -22
  138. package/lib/dependencies/ContextDependencyTemplateAsRequireCall.js +31 -31
  139. package/lib/dependencies/ContextElementDependency.js +17 -17
  140. package/lib/dependencies/DelegatedSourceDependency.js +14 -14
  141. package/lib/dependencies/DepBlockHelpers.js +41 -41
  142. package/lib/dependencies/DllEntryDependency.js +17 -17
  143. package/lib/dependencies/LabeledExportsDependency.js +21 -21
  144. package/lib/dependencies/LabeledModuleDependency.js +36 -36
  145. package/lib/dependencies/LabeledModuleDependencyParserPlugin.js +76 -76
  146. package/lib/dependencies/LabeledModulesPlugin.js +26 -26
  147. package/lib/dependencies/LoaderDependency.js +14 -14
  148. package/lib/dependencies/LoaderPlugin.js +61 -61
  149. package/lib/dependencies/LocalModule.js +19 -19
  150. package/lib/dependencies/LocalModuleDependency.js +23 -23
  151. package/lib/dependencies/LocalModulesHelpers.js +43 -43
  152. package/lib/dependencies/ModuleDependency.js +20 -20
  153. package/lib/dependencies/ModuleDependencyTemplateAsId.js +22 -22
  154. package/lib/dependencies/ModuleDependencyTemplateAsRequireId.js +22 -22
  155. package/lib/dependencies/ModuleHotAcceptDependency.js +18 -18
  156. package/lib/dependencies/ModuleHotDeclineDependency.js +18 -18
  157. package/lib/dependencies/MultiEntryDependency.js +16 -16
  158. package/lib/dependencies/NullDependency.js +17 -17
  159. package/lib/dependencies/NullDependencyTemplate.js +8 -8
  160. package/lib/dependencies/PrefetchDependency.js +14 -14
  161. package/lib/dependencies/RequireContextDependency.js +17 -17
  162. package/lib/dependencies/RequireContextDependencyParserPlugin.js +33 -33
  163. package/lib/dependencies/RequireContextPlugin.js +64 -64
  164. package/lib/dependencies/RequireEnsureDependenciesBlock.js +20 -20
  165. package/lib/dependencies/RequireEnsureDependenciesBlockParserPlugin.js +66 -66
  166. package/lib/dependencies/RequireEnsureDependency.js +29 -29
  167. package/lib/dependencies/RequireEnsureItemDependency.js +16 -16
  168. package/lib/dependencies/RequireEnsurePlugin.js +38 -38
  169. package/lib/dependencies/RequireHeaderDependency.js +25 -25
  170. package/lib/dependencies/RequireIncludeDependency.js +25 -25
  171. package/lib/dependencies/RequireIncludeDependencyParserPlugin.js +18 -18
  172. package/lib/dependencies/RequireIncludePlugin.js +31 -31
  173. package/lib/dependencies/RequireResolveContextDependency.js +18 -18
  174. package/lib/dependencies/RequireResolveDependency.js +17 -17
  175. package/lib/dependencies/RequireResolveDependencyParserPlugin.js +69 -69
  176. package/lib/dependencies/RequireResolveHeaderDependency.js +25 -25
  177. package/lib/dependencies/SingleEntryDependency.js +14 -14
  178. package/lib/dependencies/TemplateArgumentDependency.js +26 -26
  179. package/lib/dependencies/WebpackMissingModule.js +23 -23
  180. package/lib/dependencies/getFunctionExpression.js +43 -43
  181. package/lib/node/NodeChunkTemplatePlugin.js +22 -22
  182. package/lib/node/NodeEnvironmentPlugin.js +25 -25
  183. package/lib/node/NodeHotUpdateChunkTemplatePlugin.js +24 -24
  184. package/lib/node/NodeMainTemplate.runtime.js +20 -20
  185. package/lib/node/NodeMainTemplateAsync.runtime.js +34 -34
  186. package/lib/node/NodeMainTemplatePlugin.js +164 -164
  187. package/lib/node/NodeOutputFileSystem.js +17 -17
  188. package/lib/node/NodeSourcePlugin.js +85 -75
  189. package/lib/node/NodeTargetPlugin.js +12 -12
  190. package/lib/node/NodeTemplatePlugin.js +21 -21
  191. package/lib/node/NodeWatchFileSystem.js +65 -65
  192. package/lib/node/OldNodeWatchFileSystem.js +265 -265
  193. package/lib/optimize/AggressiveMergingPlugin.js +115 -115
  194. package/lib/optimize/CommonsChunkPlugin.js +178 -178
  195. package/lib/optimize/DedupePlugin.js +227 -227
  196. package/lib/optimize/FlagIncludedChunksPlugin.js +24 -24
  197. package/lib/optimize/LimitChunkCountPlugin.js +55 -55
  198. package/lib/optimize/MergeDuplicateChunksPlugin.js +30 -30
  199. package/lib/optimize/MinChunkSizePlugin.js +61 -61
  200. package/lib/optimize/OccurenceOrderPlugin.js +5 -5
  201. package/lib/optimize/OccurrenceOrderPlugin.js +91 -91
  202. package/lib/optimize/RemoveEmptyChunksPlugin.js +19 -19
  203. package/lib/optimize/RemoveParentModulesPlugin.js +50 -50
  204. package/lib/optimize/UglifyJsPlugin.js +146 -146
  205. package/lib/removeAndDo.js +13 -13
  206. package/lib/web/WebEnvironmentPlugin.js +16 -16
  207. package/lib/webpack.js +113 -113
  208. package/lib/webpack.web.js +27 -27
  209. package/lib/webworker/WebWorkerChunkTemplatePlugin.js +26 -26
  210. package/lib/webworker/WebWorkerMainTemplatePlugin.js +78 -78
  211. package/lib/webworker/WebWorkerTemplatePlugin.js +15 -15
  212. package/package.json +4 -4
package/README.md CHANGED
@@ -1,310 +1,310 @@
1
- [![webpack](https://webpack.github.io/assets/logo.png)](https://webpack.github.io)
2
-
3
-
4
- [![NPM version][npm-image]][npm-url] [![Gitter chat][gitter-image]][gitter-url] [![Downloads][downloads-image]][downloads-url]
5
- [![NPM][nodei-image]][nodei-url]
6
-
7
- build
8
- [![Build Status][travis-image]][travis-url] [![Appveyor Status][appveyor-image]][appveyor-url] [![Coverage Status][coveralls-image]][coveralls-url]
9
-
10
- dependencies
11
- [![Dependency Status][david-image]][david-url] [![devDependency Status][david-dev-image]][david-dev-url] [![peerDependency Status][david-peer-image]][david-peer-url]
12
-
13
- donation
14
- [![gratipay donate button][gratipay-image]][gratipay-url] [![Donate to sokra][donate-image]][donate-url]
15
-
16
-
17
- [documentation](https://webpack.github.io/docs/?utm_source=github&utm_medium=readme&utm_campaign=top)
18
-
19
- # Introduction
20
-
21
- webpack is a bundler for modules. The main purpose is to bundle JavaScript
22
- files for usage in a browser, yet it is also capable of transforming, bundling,
23
- or packaging just about any resource or asset.
24
-
25
-
26
- **TL; DR**
27
-
28
- * Bundles both [CommonJs](http://www.commonjs.org/specs/modules/1.0/) and [AMD](https://github.com/amdjs/amdjs-api/wiki/AMD) modules (even combined).
29
- * Can create a single bundle or multiple chunks that are asynchronously loaded at runtime (to reduce initial loading time).
30
- * Dependencies are resolved during compilation reducing the runtime size.
31
- * Loaders can preprocess files while compiling, e.g. coffeescript to JavaScript, handlebars strings to compiled functions, images to Base64, etc.
32
- * Highly modular plugin system to do whatever else your application requires.
33
-
34
- # Getting Started
35
-
36
- Check out webpack's [documentation](https://webpack.github.io/docs/?utm_source=github&utm_medium=readme&utm_campaign=trdr) for quick Getting Started guide, in-depth usage,
37
- tutorials and resources.
38
-
39
- # Installation
40
-
41
- project:
42
- `npm install webpack --save-dev`
43
-
44
- global:
45
- `npm install webpack -g`
46
- Usage
47
- https://webpack.github.io/docs/tutorials/getting-started/
48
-
49
- # Examples
50
-
51
- Take a look at the [`examples`](https://github.com/webpack/webpack/tree/master/examples) folder.
52
-
53
- # Features
54
-
55
- ## Plugins
56
-
57
- webpack has a [rich plugin
58
- interface](https://webpack.github.io/docs/plugins.html). Most of the features
59
- within webpack itself use this plugin interface. This makes webpack very
60
- **flexible**.
61
-
62
-
63
- ## Performance
64
-
65
- webpack uses async I/O and has multiple caching levels. This makes webpack fast
66
- and incredibly **fast** on incremental compilations.
67
-
68
- ## Loaders
69
-
70
- webpack enables use of loaders to preprocess files. This allows you to bundle
71
- **any static resource** way beyond JavaScript. You can easily [write your own
72
- loaders](https://webpack.github.io/docs/loaders.html) using node.js.
73
-
74
- Loaders are activated by using `loadername!` prefixes in `require()` statements,
75
- or are automatically applied via regex from your webpack configuration.
76
-
77
- Please see [Using Loaders](https://webpack.github.io/docs/using-loaders.html) for more information.
78
-
79
- **basic**
80
- * [`json`](https://github.com/webpack/json-loader): Loads file as JSON
81
- * [`raw`](https://github.com/webpack/raw-loader): Loads raw content of a file (as utf-8)
82
- * [`val`](https://github.com/webpack/val-loader): Executes code as module and consider exports as JavaScript code
83
- * [`script`](https://github.com/webpack/script-loader): Executes a JavaScript file once in global context (like in script tag), requires are not parsed.
84
-
85
- **packaging**
86
- * [`file`](https://github.com/webpack/file-loader): Emits the file into the output folder and returns the (relative) url.
87
- * [`url`](https://github.com/webpack/url-loader): The url loader works like the file loader, but can return a Data Url if the file is smaller than a limit.
88
- * [`image`](https://github.com/tcoopman/image-webpack-loader): Compresses your images. Ideal to use together with `file` or `url`.
89
- * [`svgo-loader`](https://github.com/pozadi/svgo-loader): Compresses SVG images using [svgo](https://github.com/svg/svgo) library
90
- * [`baggage`](https://github.com/deepsweet/baggage-loader): Automatically require any resources related to the required one
91
- * [`polymer-loader`](https://github.com/JonDum/polymer-loader): Process HTML & CSS with preprocessor of choice and `require()` Web Components like first-class modules.
92
-
93
- **dialects**
94
- * [`coffee`](https://github.com/webpack/coffee-loader): Loads coffee-script like JavaScript
95
- * [`babel`](https://github.com/babel/babel-loader): Turn ES6 code into vanilla ES5 using [Babel](https://github.com/babel/babel).
96
- * [`livescript`](https://github.com/appedemic/livescript-loader): Loads LiveScript like JavaScript
97
- * [`sweetjs`](https://github.com/jlongster/sweetjs-loader): Use sweetjs macros.
98
- * [`traceur`](https://github.com/jupl/traceur-loader): Use future JavaScript features with [Traceur](https://github.com/google/traceur-compiler).
99
- * [`typescript`](https://github.com/andreypopp/typescript-loader): Loads TypeScript like JavaScript.
100
-
101
- **templating**
102
- * [`html`](https://github.com/webpack/html-loader): Exports HTML as string, require references to static resources.
103
- * [`jade`](https://github.com/webpack/jade-loader): Loads jade template and returns a function
104
- * [`handlebars`](https://github.com/altano/handlebars-loader): Loads handlebars template and returns a function
105
- * [`ractive`](https://github.com/rstacruz/ractive-loader): Pre-compiles Ractive templates for interactive DOM manipulation
106
- * [`markdown`](https://github.com/peerigon/markdown-loader): Compiles Markdown to HTML
107
- * [`ng-cache`](https://github.com/teux/ng-cache-loader): Puts HTML partials in the Angular's $templateCache
108
-
109
- **styling**
110
- * [`style`](https://github.com/webpack/style-loader): Add exports of a module as style to DOM
111
- * [`css`](https://github.com/webpack/css-loader): Loads css file with resolved imports and returns css code
112
- * [`cssnext`](https://github.com/cssnext/cssnext-loader): Loads and compiles a css file using [cssnext](http://cssnext.io/)
113
- * [`less`](https://github.com/webpack/less-loader): Loads and compiles a less file
114
- * [`sass`](https://github.com/jtangelder/sass-loader): Loads and compiles a scss file
115
- * [`stylus`](https://github.com/shama/stylus-loader): Loads and compiles a stylus file
116
-
117
- **misc**
118
- * [`po`](https://github.com/dschissler/po-loader): Loads a PO gettext file and returns JSON
119
- * [`mocha`](https://github.com/webpack/mocha-loader): Do tests with mocha in browser or node.js
120
- * [`eslint`](https://github.com/MoOx/eslint-loader): PreLoader for linting code using ESLint.
121
- * [`jshint`](https://github.com/webpack/jshint-loader): PreLoader for linting code.
122
- * [`jscs`](https://github.com/unindented/jscs-loader): PreLoader for style checking.
123
- * [`injectable`](https://github.com/jauco/webpack-injectable): Allow to inject dependencies into modules
124
- * [`transform`](https://github.com/webpack/transform-loader): Use browserify transforms as loader.
125
-
126
- For the full list of loaders, see [list of loaders](https://webpack.github.io/docs/list-of-loaders.html).
127
-
128
- ## Module Format (AMD/CommonJS)
129
-
130
- webpack supports **both** AMD and CommonJS module styles. It performs clever static
131
- analysis on the AST of your code. It even has an evaluation engine to evaluate
132
- simple expressions. This allows you to **support most existing libraries** out of the box.
133
-
134
- ## Code Splitting
135
-
136
- webpack allows you to split your codebase into multiple chunks. Chunks are
137
- loaded asynchronously at runtime. This reduces the initial loading time.
138
-
139
- [Code Splitting documentation](https://webpack.github.io/docs/code-splitting.html)
140
-
141
- ## Optimizations
142
-
143
- webpack can do many optimizations to **reduce the output size of your
144
- JavaScript** by deduplicating frequently used modules, minifying, and giving
145
- you full control of what is loaded initially and what is loaded at runtime
146
- through code splitting. It can also can make your code chunks **cache
147
- friendly** by using hashes.
148
-
149
- [Optimization documentation](https://webpack.github.io/docs/optimization.html)
150
-
151
- webpack optimizes in several ways. It also makes your chunks **cache-friendly** by using hashes.
152
-
153
- # A small example of what's possible
154
-
155
- ``` javascript
156
- // webpack is a module bundler.
157
- // This means webpack takes modules with dependencies
158
- // and emits static assets representing those modules.
159
-
160
- // Dependencies can be written in CommonJs
161
- var commonjs = require("./commonjs");
162
- // or in AMD
163
- define(["amd-module", "../file"], function (amdModule, file) {
164
- // while previous constructs are sync,
165
- // this is async
166
- require(["big-module/big/file"], function (big) {
167
- // For async dependencies, webpack splits
168
- // your application into multiple "chunks".
169
- // This part of your application is
170
- // loaded on demand (code-splitting).
171
- var stuff = require("../my/stuff");
172
- // "../my/stuff" is also loaded on-demand
173
- // because it's in the callback function
174
- // of the AMD require.
175
- });
176
- });
177
-
178
-
179
- require("coffee!./cup.coffee");
180
- // "Loaders" are used to preprocess files.
181
- // They can be prefixed in the require call
182
- // or configured in the configuration.
183
- require("./cup");
184
- // This does the same when you add ".coffee" to the extensions
185
- // and configure the "coffee" loader for /\.coffee$/
186
-
187
- function loadTemplate (name) {
188
- return require("./templates/" + name + ".jade");
189
- // Many expressions are supported in require calls.
190
- // A clever parser extracts information and concludes
191
- // that everything in "./templates" that matches
192
- // /\.jade$/ should be included in the bundle, as it
193
- // can be required.
194
- }
195
-
196
-
197
- // ...and you can combine everything.
198
- function loadTemplateAsync (name, callback) {
199
- require(["bundle?lazy!./templates/" + name + ".jade"],
200
- function (templateBundle) {
201
- templateBundle(callback);
202
- });
203
- }
204
- ```
205
-
206
- ## Documentation
207
-
208
- [documentation](https://webpack.github.io/docs/?utm_source=github&utm_medium=readme&utm_campaign=documentation)
209
-
210
-
211
- ## Changelog
212
-
213
- [changelog](https://webpack.github.io/docs/changelog.html)
214
-
215
-
216
- ## Tests
217
-
218
- You can run the Node tests with `npm test`.
219
-
220
- You can run the browser tests:
221
-
222
- ```
223
- cd test/browsertests
224
- node build
225
- ```
226
-
227
- and open `tests.html` in the browser.
228
-
229
- ## Contribution
230
-
231
- Most of the time, if webpack is not working correctly for you it is a simple configuration issue.
232
-
233
- If you are still having difficulty after looking over your configuration carefully, please post
234
- a question to [StackOverflow with the webpack tag](http://stackoverflow.com/tags/webpack). Questions
235
- that include your webpack.config.js and relevant files are more likely to receive responses.
236
-
237
- If you have discovered a bug or have a feature suggestion, feel free to create an issue on Github.
238
-
239
- If you create a loader or plugin, please consider open sourcing it, putting it
240
- on NPM and following the `x-loader`, `x-plugin` convention.
241
-
242
- You are also welcome to correct any spelling mistakes or any language issues.
243
-
244
- If you want to discuss something or just need help, [here is our gitter.im room](https://gitter.im/webpack/webpack).
245
-
246
- ## License
247
-
248
- Copyright (c) 2012-2015 Tobias Koppers
249
-
250
- MIT (http://www.opensource.org/licenses/mit-license.php)
251
-
252
- ## Thanks to
253
-
254
- (In chronological order)
255
-
256
- * @google for [Google Web Toolkit (GWT)](https://code.google.com/p/google-web-toolkit), which aims to compile Java to JavaScript. It features a similar [Code Splitting](https://code.google.com/p/google-web-toolkit/wiki/CodeSplitting) as webpack.
257
- * @medikoo for [modules-webmake](https://github.com/medikoo/modules-webmake), which is a similar project. webpack was born because I wanted Code Splitting for modules-webpack. Interestingly the [Code Splitting issue is still open](https://github.com/medikoo/modules-webmake/issues/7) (thanks also to @Phoscur for the discussion).
258
- * @substack for [browserify](http://browserify.org/), which is a similar project and source for many ideas.
259
- * @jrburke for [require.js](http://requirejs.org/), which is a similar project and source for many ideas.
260
- * @defunctzombie for the [browser-field spec](https://gist.github.com/defunctzombie/4339901), which makes modules available for node.js, browserify and webpack.
261
- * Every early webpack user, which contributed to webpack by writing issues or PRs. You influenced the direction...
262
- * @shama, @jhnns and @sokra for maintaining this project
263
- * Everyone who has written a loader for webpack. You are the ecosystem...
264
- * Everyone I forgot to mention here, but also influenced webpack.
265
-
266
-
267
- ## Sponsor
268
-
269
- This is a free-time project. The time I invest in it fluctuates. If you use webpack for a serious task, and you'd like me to invest more time on it, please donate. This project increases your income/productivity too. It makes development and applications faster and it reduces the required bandwidth.
270
-
271
- I'm very thankful for every dollar. If you leave your username or email, I may show my thanks by giving you extra support.
272
-
273
-
274
- ## Dependencies
275
-
276
- * [esprima](http://esprima.org/)
277
- * [enhanced-resolve](https://github.com/webpack/enhanced-resolve)
278
- * [uglify-js](https://github.com/mishoo/UglifyJS)
279
- * [mocha](https://github.com/visionmedia/mocha)
280
- * [should](https://github.com/visionmedia/should.js)
281
- * [optimist](https://github.com/substack/node-optimist)
282
- * [async](https://github.com/caolan/async)
283
- * [mkdirp](https://github.com/substack/node-mkdirp)
284
- * [clone](https://github.com/pvorb/node-clone)
285
-
286
-
287
- [travis-url]: http://travis-ci.org/webpack/webpack
288
- [travis-image]: https://img.shields.io/travis/webpack/webpack.svg
289
- [appveyor-url]: https://ci.appveyor.com/project/sokra/webpack/branch/master
290
- [appveyor-image]: https://ci.appveyor.com/api/projects/status/github/webpack/webpack?svg=true
291
- [coveralls-url]: https://coveralls.io/r/webpack/webpack/
292
- [coveralls-image]: https://img.shields.io/coveralls/webpack/webpack.svg
293
- [npm-url]: https://npmjs.org/package/webpack
294
- [npm-image]: https://img.shields.io/npm/v/webpack.svg
295
- [downloads-image]: http://img.shields.io/npm/dm/webpack.svg
296
- [downloads-url]: http://badge.fury.io/js/webpack
297
- [david-url]: https://david-dm.org/webpack/webpack
298
- [david-image]: https://img.shields.io/david/webpack/webpack.svg
299
- [david-dev-url]: https://david-dm.org/webpack/webpack#info=devDependencies
300
- [david-dev-image]: https://david-dm.org/webpack/webpack/dev-status.svg
301
- [david-peer-url]: https://david-dm.org/webpack/webpack#info=peerDependencies
302
- [david-peer-image]: https://david-dm.org/webpack/webpack/peer-status.svg
303
- [nodei-image]: https://nodei.co/npm/webpack.png?downloads=true&downloadRank=true&stars=true
304
- [nodei-url]: https://nodei.co/npm/webpack
305
- [donate-url]: http://sokra.github.io/
306
- [donate-image]: https://img.shields.io/badge/donate-sokra-brightgreen.svg
307
- [gratipay-url]: https://gratipay.com/webpack/
308
- [gratipay-image]: https://img.shields.io/gratipay/webpack.svg
309
- [gitter-url]: https://gitter.im/webpack/webpack
310
- [gitter-image]: https://img.shields.io/badge/gitter-webpack%2Fwebpack-brightgreen.svg
1
+ [![webpack](https://webpack.github.io/assets/logo.png)](https://webpack.github.io)
2
+
3
+
4
+ [![NPM version][npm-image]][npm-url] [![Gitter chat][gitter-image]][gitter-url] [![Downloads][downloads-image]][downloads-url]
5
+ [![NPM][nodei-image]][nodei-url]
6
+
7
+ build
8
+ [![Build Status][travis-image]][travis-url] [![Appveyor Status][appveyor-image]][appveyor-url] [![Coverage Status][coveralls-image]][coveralls-url]
9
+
10
+ dependencies
11
+ [![Dependency Status][david-image]][david-url] [![devDependency Status][david-dev-image]][david-dev-url] [![peerDependency Status][david-peer-image]][david-peer-url]
12
+
13
+ donation
14
+ [![gratipay donate button][gratipay-image]][gratipay-url] [![Donate to sokra][donate-image]][donate-url]
15
+
16
+
17
+ [documentation](https://webpack.github.io/docs/?utm_source=github&utm_medium=readme&utm_campaign=top)
18
+
19
+ # Introduction
20
+
21
+ webpack is a bundler for modules. The main purpose is to bundle JavaScript
22
+ files for usage in a browser, yet it is also capable of transforming, bundling,
23
+ or packaging just about any resource or asset.
24
+
25
+
26
+ **TL; DR**
27
+
28
+ * Bundles both [CommonJs](http://www.commonjs.org/specs/modules/1.0/) and [AMD](https://github.com/amdjs/amdjs-api/wiki/AMD) modules (even combined).
29
+ * Can create a single bundle or multiple chunks that are asynchronously loaded at runtime (to reduce initial loading time).
30
+ * Dependencies are resolved during compilation reducing the runtime size.
31
+ * Loaders can preprocess files while compiling, e.g. coffeescript to JavaScript, handlebars strings to compiled functions, images to Base64, etc.
32
+ * Highly modular plugin system to do whatever else your application requires.
33
+
34
+ # Getting Started
35
+
36
+ Check out webpack's [documentation](https://webpack.github.io/docs/?utm_source=github&utm_medium=readme&utm_campaign=trdr) for quick Getting Started guide, in-depth usage,
37
+ tutorials and resources.
38
+
39
+ # Installation
40
+
41
+ project:
42
+ `npm install webpack --save-dev`
43
+
44
+ global:
45
+ `npm install webpack -g`
46
+ Usage
47
+ https://webpack.github.io/docs/tutorials/getting-started/
48
+
49
+ # Examples
50
+
51
+ Take a look at the [`examples`](https://github.com/webpack/webpack/tree/master/examples) folder.
52
+
53
+ # Features
54
+
55
+ ## Plugins
56
+
57
+ webpack has a [rich plugin
58
+ interface](https://webpack.github.io/docs/plugins.html). Most of the features
59
+ within webpack itself use this plugin interface. This makes webpack very
60
+ **flexible**.
61
+
62
+
63
+ ## Performance
64
+
65
+ webpack uses async I/O and has multiple caching levels. This makes webpack fast
66
+ and incredibly **fast** on incremental compilations.
67
+
68
+ ## Loaders
69
+
70
+ webpack enables use of loaders to preprocess files. This allows you to bundle
71
+ **any static resource** way beyond JavaScript. You can easily [write your own
72
+ loaders](https://webpack.github.io/docs/loaders.html) using node.js.
73
+
74
+ Loaders are activated by using `loadername!` prefixes in `require()` statements,
75
+ or are automatically applied via regex from your webpack configuration.
76
+
77
+ Please see [Using Loaders](https://webpack.github.io/docs/using-loaders.html) for more information.
78
+
79
+ **basic**
80
+ * [`json`](https://github.com/webpack/json-loader): Loads file as JSON
81
+ * [`raw`](https://github.com/webpack/raw-loader): Loads raw content of a file (as utf-8)
82
+ * [`val`](https://github.com/webpack/val-loader): Executes code as module and consider exports as JavaScript code
83
+ * [`script`](https://github.com/webpack/script-loader): Executes a JavaScript file once in global context (like in script tag), requires are not parsed.
84
+
85
+ **packaging**
86
+ * [`file`](https://github.com/webpack/file-loader): Emits the file into the output folder and returns the (relative) url.
87
+ * [`url`](https://github.com/webpack/url-loader): The url loader works like the file loader, but can return a Data Url if the file is smaller than a limit.
88
+ * [`image`](https://github.com/tcoopman/image-webpack-loader): Compresses your images. Ideal to use together with `file` or `url`.
89
+ * [`svgo-loader`](https://github.com/pozadi/svgo-loader): Compresses SVG images using [svgo](https://github.com/svg/svgo) library
90
+ * [`baggage`](https://github.com/deepsweet/baggage-loader): Automatically require any resources related to the required one
91
+ * [`polymer-loader`](https://github.com/JonDum/polymer-loader): Process HTML & CSS with preprocessor of choice and `require()` Web Components like first-class modules.
92
+
93
+ **dialects**
94
+ * [`coffee`](https://github.com/webpack/coffee-loader): Loads coffee-script like JavaScript
95
+ * [`babel`](https://github.com/babel/babel-loader): Turn ES6 code into vanilla ES5 using [Babel](https://github.com/babel/babel).
96
+ * [`livescript`](https://github.com/appedemic/livescript-loader): Loads LiveScript like JavaScript
97
+ * [`sweetjs`](https://github.com/jlongster/sweetjs-loader): Use sweetjs macros.
98
+ * [`traceur`](https://github.com/jupl/traceur-loader): Use future JavaScript features with [Traceur](https://github.com/google/traceur-compiler).
99
+ * [`typescript`](https://github.com/andreypopp/typescript-loader): Loads TypeScript like JavaScript.
100
+
101
+ **templating**
102
+ * [`html`](https://github.com/webpack/html-loader): Exports HTML as string, require references to static resources.
103
+ * [`jade`](https://github.com/webpack/jade-loader): Loads jade template and returns a function
104
+ * [`handlebars`](https://github.com/altano/handlebars-loader): Loads handlebars template and returns a function
105
+ * [`ractive`](https://github.com/rstacruz/ractive-loader): Pre-compiles Ractive templates for interactive DOM manipulation
106
+ * [`markdown`](https://github.com/peerigon/markdown-loader): Compiles Markdown to HTML
107
+ * [`ng-cache`](https://github.com/teux/ng-cache-loader): Puts HTML partials in the Angular's $templateCache
108
+
109
+ **styling**
110
+ * [`style`](https://github.com/webpack/style-loader): Add exports of a module as style to DOM
111
+ * [`css`](https://github.com/webpack/css-loader): Loads css file with resolved imports and returns css code
112
+ * [`cssnext`](https://github.com/cssnext/cssnext-loader): Loads and compiles a css file using [cssnext](http://cssnext.io/)
113
+ * [`less`](https://github.com/webpack/less-loader): Loads and compiles a less file
114
+ * [`sass`](https://github.com/jtangelder/sass-loader): Loads and compiles a scss file
115
+ * [`stylus`](https://github.com/shama/stylus-loader): Loads and compiles a stylus file
116
+
117
+ **misc**
118
+ * [`po`](https://github.com/dschissler/po-loader): Loads a PO gettext file and returns JSON
119
+ * [`mocha`](https://github.com/webpack/mocha-loader): Do tests with mocha in browser or node.js
120
+ * [`eslint`](https://github.com/MoOx/eslint-loader): PreLoader for linting code using ESLint.
121
+ * [`jshint`](https://github.com/webpack/jshint-loader): PreLoader for linting code.
122
+ * [`jscs`](https://github.com/unindented/jscs-loader): PreLoader for style checking.
123
+ * [`injectable`](https://github.com/jauco/webpack-injectable): Allow to inject dependencies into modules
124
+ * [`transform`](https://github.com/webpack/transform-loader): Use browserify transforms as loader.
125
+
126
+ For the full list of loaders, see [list of loaders](https://webpack.github.io/docs/list-of-loaders.html).
127
+
128
+ ## Module Format (AMD/CommonJS)
129
+
130
+ webpack supports **both** AMD and CommonJS module styles. It performs clever static
131
+ analysis on the AST of your code. It even has an evaluation engine to evaluate
132
+ simple expressions. This allows you to **support most existing libraries** out of the box.
133
+
134
+ ## Code Splitting
135
+
136
+ webpack allows you to split your codebase into multiple chunks. Chunks are
137
+ loaded asynchronously at runtime. This reduces the initial loading time.
138
+
139
+ [Code Splitting documentation](https://webpack.github.io/docs/code-splitting.html)
140
+
141
+ ## Optimizations
142
+
143
+ webpack can do many optimizations to **reduce the output size of your
144
+ JavaScript** by deduplicating frequently used modules, minifying, and giving
145
+ you full control of what is loaded initially and what is loaded at runtime
146
+ through code splitting. It can also can make your code chunks **cache
147
+ friendly** by using hashes.
148
+
149
+ [Optimization documentation](https://webpack.github.io/docs/optimization.html)
150
+
151
+ webpack optimizes in several ways. It also makes your chunks **cache-friendly** by using hashes.
152
+
153
+ # A small example of what's possible
154
+
155
+ ``` javascript
156
+ // webpack is a module bundler.
157
+ // This means webpack takes modules with dependencies
158
+ // and emits static assets representing those modules.
159
+
160
+ // Dependencies can be written in CommonJs
161
+ var commonjs = require("./commonjs");
162
+ // or in AMD
163
+ define(["amd-module", "../file"], function (amdModule, file) {
164
+ // while previous constructs are sync,
165
+ // this is async
166
+ require(["big-module/big/file"], function (big) {
167
+ // For async dependencies, webpack splits
168
+ // your application into multiple "chunks".
169
+ // This part of your application is
170
+ // loaded on demand (code-splitting).
171
+ var stuff = require("../my/stuff");
172
+ // "../my/stuff" is also loaded on-demand
173
+ // because it's in the callback function
174
+ // of the AMD require.
175
+ });
176
+ });
177
+
178
+
179
+ require("coffee!./cup.coffee");
180
+ // "Loaders" are used to preprocess files.
181
+ // They can be prefixed in the require call
182
+ // or configured in the configuration.
183
+ require("./cup");
184
+ // This does the same when you add ".coffee" to the extensions
185
+ // and configure the "coffee" loader for /\.coffee$/
186
+
187
+ function loadTemplate (name) {
188
+ return require("./templates/" + name + ".jade");
189
+ // Many expressions are supported in require calls.
190
+ // A clever parser extracts information and concludes
191
+ // that everything in "./templates" that matches
192
+ // /\.jade$/ should be included in the bundle, as it
193
+ // can be required.
194
+ }
195
+
196
+
197
+ // ...and you can combine everything.
198
+ function loadTemplateAsync (name, callback) {
199
+ require(["bundle?lazy!./templates/" + name + ".jade"],
200
+ function (templateBundle) {
201
+ templateBundle(callback);
202
+ });
203
+ }
204
+ ```
205
+
206
+ ## Documentation
207
+
208
+ [documentation](https://webpack.github.io/docs/?utm_source=github&utm_medium=readme&utm_campaign=documentation)
209
+
210
+
211
+ ## Changelog
212
+
213
+ [changelog](https://webpack.github.io/docs/changelog.html)
214
+
215
+
216
+ ## Tests
217
+
218
+ You can run the Node tests with `npm test`.
219
+
220
+ You can run the browser tests:
221
+
222
+ ```
223
+ cd test/browsertests
224
+ node build
225
+ ```
226
+
227
+ and open `tests.html` in the browser.
228
+
229
+ ## Contribution
230
+
231
+ Most of the time, if webpack is not working correctly for you it is a simple configuration issue.
232
+
233
+ If you are still having difficulty after looking over your configuration carefully, please post
234
+ a question to [StackOverflow with the webpack tag](http://stackoverflow.com/tags/webpack). Questions
235
+ that include your webpack.config.js and relevant files are more likely to receive responses.
236
+
237
+ If you have discovered a bug or have a feature suggestion, feel free to create an issue on Github.
238
+
239
+ If you create a loader or plugin, please consider open sourcing it, putting it
240
+ on NPM and following the `x-loader`, `x-plugin` convention.
241
+
242
+ You are also welcome to correct any spelling mistakes or any language issues.
243
+
244
+ If you want to discuss something or just need help, [here is our gitter.im room](https://gitter.im/webpack/webpack).
245
+
246
+ ## License
247
+
248
+ Copyright (c) 2012-2015 Tobias Koppers
249
+
250
+ MIT (http://www.opensource.org/licenses/mit-license.php)
251
+
252
+ ## Thanks to
253
+
254
+ (In chronological order)
255
+
256
+ * @google for [Google Web Toolkit (GWT)](https://code.google.com/p/google-web-toolkit), which aims to compile Java to JavaScript. It features a similar [Code Splitting](https://code.google.com/p/google-web-toolkit/wiki/CodeSplitting) as webpack.
257
+ * @medikoo for [modules-webmake](https://github.com/medikoo/modules-webmake), which is a similar project. webpack was born because I wanted Code Splitting for modules-webpack. Interestingly the [Code Splitting issue is still open](https://github.com/medikoo/modules-webmake/issues/7) (thanks also to @Phoscur for the discussion).
258
+ * @substack for [browserify](http://browserify.org/), which is a similar project and source for many ideas.
259
+ * @jrburke for [require.js](http://requirejs.org/), which is a similar project and source for many ideas.
260
+ * @defunctzombie for the [browser-field spec](https://gist.github.com/defunctzombie/4339901), which makes modules available for node.js, browserify and webpack.
261
+ * Every early webpack user, which contributed to webpack by writing issues or PRs. You influenced the direction...
262
+ * @shama, @jhnns and @sokra for maintaining this project
263
+ * Everyone who has written a loader for webpack. You are the ecosystem...
264
+ * Everyone I forgot to mention here, but also influenced webpack.
265
+
266
+
267
+ ## Sponsor
268
+
269
+ This is a free-time project. The time I invest in it fluctuates. If you use webpack for a serious task, and you'd like me to invest more time on it, please donate. This project increases your income/productivity too. It makes development and applications faster and it reduces the required bandwidth.
270
+
271
+ I'm very thankful for every dollar. If you leave your username or email, I may show my thanks by giving you extra support.
272
+
273
+
274
+ ## Dependencies
275
+
276
+ * [esprima](http://esprima.org/)
277
+ * [enhanced-resolve](https://github.com/webpack/enhanced-resolve)
278
+ * [uglify-js](https://github.com/mishoo/UglifyJS)
279
+ * [mocha](https://github.com/visionmedia/mocha)
280
+ * [should](https://github.com/visionmedia/should.js)
281
+ * [optimist](https://github.com/substack/node-optimist)
282
+ * [async](https://github.com/caolan/async)
283
+ * [mkdirp](https://github.com/substack/node-mkdirp)
284
+ * [clone](https://github.com/pvorb/node-clone)
285
+
286
+
287
+ [travis-url]: http://travis-ci.org/webpack/webpack
288
+ [travis-image]: https://img.shields.io/travis/webpack/webpack.svg
289
+ [appveyor-url]: https://ci.appveyor.com/project/sokra/webpack/branch/master
290
+ [appveyor-image]: https://ci.appveyor.com/api/projects/status/github/webpack/webpack?svg=true
291
+ [coveralls-url]: https://coveralls.io/r/webpack/webpack/
292
+ [coveralls-image]: https://img.shields.io/coveralls/webpack/webpack.svg
293
+ [npm-url]: https://npmjs.org/package/webpack
294
+ [npm-image]: https://img.shields.io/npm/v/webpack.svg
295
+ [downloads-image]: http://img.shields.io/npm/dm/webpack.svg
296
+ [downloads-url]: http://badge.fury.io/js/webpack
297
+ [david-url]: https://david-dm.org/webpack/webpack
298
+ [david-image]: https://img.shields.io/david/webpack/webpack.svg
299
+ [david-dev-url]: https://david-dm.org/webpack/webpack#info=devDependencies
300
+ [david-dev-image]: https://david-dm.org/webpack/webpack/dev-status.svg
301
+ [david-peer-url]: https://david-dm.org/webpack/webpack#info=peerDependencies
302
+ [david-peer-image]: https://david-dm.org/webpack/webpack/peer-status.svg
303
+ [nodei-image]: https://nodei.co/npm/webpack.png?downloads=true&downloadRank=true&stars=true
304
+ [nodei-url]: https://nodei.co/npm/webpack
305
+ [donate-url]: http://sokra.github.io/
306
+ [donate-image]: https://img.shields.io/badge/donate-sokra-brightgreen.svg
307
+ [gratipay-url]: https://gratipay.com/webpack/
308
+ [gratipay-image]: https://img.shields.io/gratipay/webpack.svg
309
+ [gitter-url]: https://gitter.im/webpack/webpack
310
+ [gitter-image]: https://img.shields.io/badge/gitter-webpack%2Fwebpack-brightgreen.svg
@@ -1 +1 @@
1
- module.exports = function() { throw new Error("define cannot be used indirect"); };
1
+ module.exports = function() { throw new Error("define cannot be used indirect"); };
@@ -1 +1 @@
1
- module.exports = __webpack_amd_options__;
1
+ module.exports = __webpack_amd_options__;