From 2817af4ad3c0ef11e77d1120391f8d37eb028232 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Achim=20Kr=C3=BCger?= Date: Thu, 29 Jun 2017 05:07:03 +0200 Subject: [PATCH 001/161] docs(guides): add `resolve.extensions` to typescript.md (#1341) Otherwise it's not possible to resolve imports in the entry file from other .ts or .tsx files --- content/guides/typescript.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/content/guides/typescript.md b/content/guides/typescript.md index ddffdb918a55..4065d056d7a9 100644 --- a/content/guides/typescript.md +++ b/content/guides/typescript.md @@ -62,6 +62,9 @@ module.exports = { } ] }, + resolve: { + extensions: [".tsx", ".ts", ".js"] + }, output: { filename: 'bundle.js', path: __dirname From 685ed3858f41d0d60c75d12ae563697662bac19c Mon Sep 17 00:00:00 2001 From: Donald Pipowitch Date: Thu, 29 Jun 2017 05:08:59 +0200 Subject: [PATCH 002/161] docs(config): correct issue in performance.md (#1342) --- content/configuration/performance.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/content/configuration/performance.md b/content/configuration/performance.md index e8e7685d6f10..4ca3c69a01e6 100644 --- a/content/configuration/performance.md +++ b/content/configuration/performance.md @@ -17,7 +17,7 @@ Configure how performance hints are shown. For example if you have an asset that ## `performance.hints` -`boolean | "error" | "warning"` +`false | "error" | "warning"` Turns hints on/off. In addition, tells webpack to throw either an error or a warning when hints are found. This property is set to `"warning"` by default. From 63cc51ccb4e7c18645605c68b31a38bae981661f Mon Sep 17 00:00:00 2001 From: Kevin Yank Date: Thu, 29 Jun 2017 13:11:21 +1000 Subject: [PATCH 003/161] docs(api): improve documentation for --profile (#1343) The sample output that was previously shown for `--profile` will not appear unless `--progress` is also used. This change spells this out, and also describes the per-module timings that `--profile` produces by itself. --- content/api/cli.md | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/content/api/cli.md b/content/api/cli.md index 73907ab0be5f..40c16490da9e 100644 --- a/content/api/cli.md +++ b/content/api/cli.md @@ -289,11 +289,27 @@ These options allow webpack to display various [stats](/configuration/stats/) an ### Profiling -This option profiles the compilation and includes this information in the stats output. It gives you an in depth idea of which step in the compilation is taking how long. This can help you optimise your build in a more informed manner. +The `--profile` option captures timing information for each step of the compilation and includes this in the output. ```bash webpack --profile +⋮ +[0] ./src/index.js 90 bytes {0} [built] + factory:22ms building:16ms = 38ms +``` + +For each module, the following details are included in the output as applicable: + +* `factory`: time to collect module metadata (e.g. resolving the filename) +* `building`: time to build the module (e.g. loaders and parsing) +* `dependencies`: time to identify and connect the module’s dependencies + +Paired with `--progress`, `--profile` gives you an in depth idea of which step in the compilation is taking how long. This can help you optimise your build in a more informed manner. + +```bash +webpack --progress --profile + 30ms building modules 1ms sealing 1ms optimizing @@ -319,4 +335,5 @@ webpack --profile 26ms chunk asset optimization 1ms asset optimization 6ms emitting +⋮ ``` From 2f1a667cfcb9c82df5ba3dbcc6ca72888688ea4d Mon Sep 17 00:00:00 2001 From: Peter Uithoven Date: Thu, 29 Jun 2017 05:21:11 +0200 Subject: [PATCH 004/161] docs(guides): fix `path` in output-managment guide (#1346) Solves the following error: `configuration.output.path: The provided value "dist" is not an absolute path!`. Now it also uses the same output path as the "Getting started" > "Using a Configuration" guide. --- content/guides/output-management.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/content/guides/output-management.md b/content/guides/output-management.md index 858ac2a52ba2..7e0f3174e262 100644 --- a/content/guides/output-management.md +++ b/content/guides/output-management.md @@ -37,6 +37,7 @@ In comes the [`HtmlWebpackPlugin`](/plugins/html-webpack-plugin) to save the day __webpack.config.js__ ``` js +var path = require('path'); var HtmlWebpackPlugin = require('html-webpack-plugin'); module.exports = { @@ -46,7 +47,7 @@ module.exports = { }, output: { - path: 'dist', + path: path.resolve(__dirname, 'dist'), filename: '[name].bundle.js' }, From cf6460b902749d4814672a30ef9e4f35965e1781 Mon Sep 17 00:00:00 2001 From: Peter Uithoven Date: Thu, 29 Jun 2017 05:23:24 +0200 Subject: [PATCH 005/161] docs(guides): fix output management entry config (#1347) --- content/guides/output-management.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/content/guides/output-management.md b/content/guides/output-management.md index 7e0f3174e262..97346bb3c3a0 100644 --- a/content/guides/output-management.md +++ b/content/guides/output-management.md @@ -42,7 +42,7 @@ var HtmlWebpackPlugin = require('html-webpack-plugin'); module.exports = { entry: { - app: './index.js', + app: './src/index.js', vendor: [ 'react', 'react-dom' ] }, From 03464f8dff343fa67d283259b62c5a912bd3d0fc Mon Sep 17 00:00:00 2001 From: Tommy Yu Date: Wed, 28 Jun 2017 20:28:01 -0700 Subject: [PATCH 006/161] docs(config): elaborate on array usage in externals (#1348) To make it easier to discover use case reported by webpack/webpack#4665 from the documentation, as the existing array example only convey/imply that only modules are supported by this construct. --- content/configuration/externals.md | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/content/configuration/externals.md b/content/configuration/externals.md index 06eb2e49572f..0685e68adc75 100644 --- a/content/configuration/externals.md +++ b/content/configuration/externals.md @@ -88,9 +88,17 @@ externals : { root: "_" // indicates global variable } } + +// or + +externals : { + subtract : { + root: ["math", "subtract"] + } +} ``` -This syntax is used to describe all the possible ways that an external library can be available. `lodash` here is available as `lodash` under AMD and CommonJS module systems but available as `_` in a global variable form. +This syntax is used to describe all the possible ways that an external library can be available. `lodash` here is available as `lodash` under AMD and CommonJS module systems but available as `_` in a global variable form. `subtract` here is available via the property `subtract` under the global `math` object (e.g. `window['math']['subtract']`). ### function From 03e8a5dd30413a14d7b2cf2aa236bd8683f0a0a8 Mon Sep 17 00:00:00 2001 From: JonnieCache Date: Thu, 29 Jun 2017 13:21:23 +0100 Subject: [PATCH 007/161] docs(guides): fix definition of `webpack -p` in production.md (#1349) Fix definition of `webpack -p` command line option expansion, at the top of this page its missing the needed single quotes which are present down below. --- content/guides/production.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/content/guides/production.md b/content/guides/production.md index 3a4876571f5f..7451ca89c6c9 100644 --- a/content/guides/production.md +++ b/content/guides/production.md @@ -20,7 +20,7 @@ The following article describes the best practices and tools to use when using w ## The Automatic Way -Running `webpack -p` (or equivalently `webpack --optimize-minimize --define process.env.NODE_ENV="production"`). This performs the following steps: +Running `webpack -p` (or equivalently `webpack --optimize-minimize --define process.env.NODE_ENV="'production'"`). This performs the following steps: - Minification using `UglifyJsPlugin` - Runs the `LoaderOptionsPlugin` (see its [documentation](/plugins/loader-options-plugin)) From 310b42ed839d9ed888b533c19aab34b6656c9cda Mon Sep 17 00:00:00 2001 From: Greg Venech Date: Sat, 24 Jun 2017 09:05:01 -0400 Subject: [PATCH 008/161] docs(guides): remove to incomplete guides We can choose to revive these later if they are requested by a significant amount of people. Also, especially the content in compatibility.md, is covered in other places (specifically in the `module-***.md` pages in `/api`). --- content/guides/build-performance.md | 24 ------------------------ content/guides/compatibility.md | 20 -------------------- 2 files changed, 44 deletions(-) delete mode 100644 content/guides/build-performance.md delete mode 100644 content/guides/compatibility.md diff --git a/content/guides/build-performance.md b/content/guides/build-performance.md deleted file mode 100644 index 23c2fd3ba764..000000000000 --- a/content/guides/build-performance.md +++ /dev/null @@ -1,24 +0,0 @@ ---- -title: Build Performance -sort: 25 ---- - -?> incremental builds - -?> profile - -?> analyse tool - -?> dirty chunks ([chunkhash]) - -?> source maps - -?> PrefetchPlugin - -?> resolving - -?> DllPlugin - -[Development Tools](/guides/development/#choosing-a-tool) - -> see also [resolving](/concepts/module-resolution/#resolving-rules-in-webpack) diff --git a/content/guides/compatibility.md b/content/guides/compatibility.md deleted file mode 100644 index 00e7a7f477f1..000000000000 --- a/content/guides/compatibility.md +++ /dev/null @@ -1,20 +0,0 @@ ---- -title: Handling Compatibility -sort: 25 ---- - -?> require.main - -?> require.cache - -?> module.loaded - -?> global - -?> process - -?> __dirname - -?> __filename - -?> module.id From 690eb553b49b08e629a33c3f97cabbfa1c0fa3e6 Mon Sep 17 00:00:00 2001 From: Greg Venech Date: Sat, 24 Jun 2017 09:07:09 -0400 Subject: [PATCH 009/161] docs(guides): move the comparison guide out of the guides section This isn't really as much of an instructional as it is just information about different bundling and build systems. --- components/footer/footer.jsx | 4 ++-- content/{guides => }/comparison.md | 0 content/guides/getting-started.md | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) rename content/{guides => }/comparison.md (100%) diff --git a/components/footer/footer.jsx b/components/footer/footer.jsx index c4bec48c27db..e364a070345c 100644 --- a/components/footer/footer.jsx +++ b/components/footer/footer.jsx @@ -11,10 +11,10 @@ export default (props) => {