From 9be1482607c1f212f4999f78120845d9b7dc77a5 Mon Sep 17 00:00:00 2001 From: EugeneHlushko Date: Sun, 11 Mar 2018 14:29:05 +0200 Subject: [PATCH 1/2] docs(configuration) Update snippets to comply with webpack v4+ --- src/content/concepts/configuration.md | 3 ++- src/content/configuration/configuration-languages.md | 4 +++- src/content/configuration/configuration-types.md | 3 +++ src/content/configuration/index.md | 4 ++++ 4 files changed, 12 insertions(+), 2 deletions(-) diff --git a/src/content/concepts/configuration.md b/src/content/concepts/configuration.md index 6bcb1f46cdf3..e2d4828f7bbe 100644 --- a/src/content/concepts/configuration.md +++ b/src/content/concepts/configuration.md @@ -28,7 +28,7 @@ T> The most important part to take away from this document is that there are man The following examples below describe how webpack's configuration object can be both expressive and configurable because _it is code_: -## The Simplest Configuration +## Simple Configuration **webpack.config.js** @@ -36,6 +36,7 @@ The following examples below describe how webpack's configuration object can be var path = require('path'); module.exports = { + mode: 'development', entry: './foo.js', output: { path: path.resolve(__dirname, 'dist'), diff --git a/src/content/configuration/configuration-languages.md b/src/content/configuration/configuration-languages.md index a3ac2379200f..e0589ae82966 100644 --- a/src/content/configuration/configuration-languages.md +++ b/src/content/configuration/configuration-languages.md @@ -30,6 +30,7 @@ import * as webpack from 'webpack'; import * as path from 'path'; const config: webpack.Configuration = { + mode: 'production', entry: './foo.js', output: { path: path.resolve(__dirname, 'dist'), @@ -101,6 +102,7 @@ webpack = require('webpack') path = require('path') config = + mode: 'production' entry: './path/to/my/entry/file.js' output: path: path.resolve(__dirname, 'dist') @@ -150,7 +152,7 @@ const CustomPlugin = config => ({ }); export default ( - + + [mode](/concepts/mode): "production", // string + + // Chosen mode tells webpack to use its built-in optimizations accordingly.
[entry](/configuration/entry-context#entry): "./app/entry", // string | object | array [entry](/configuration/entry-context#entry): ["./app/entry1", "./app/entry2"], [entry](/configuration/entry-context#entry): { From 6ccf4f4426538ec99526f1f5e661dca200250e62 Mon Sep 17 00:00:00 2001 From: Tobias Koppers Date: Wed, 21 Mar 2018 17:08:56 +0100 Subject: [PATCH 2/2] Expand mode for more info --- src/content/configuration/index.md | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/content/configuration/index.md b/src/content/configuration/index.md index d600654cadc5..bad32c626a2c 100644 --- a/src/content/configuration/index.md +++ b/src/content/configuration/index.md @@ -29,10 +29,13 @@ __webpack.config.js__ const path = require('path'); module.exports = { -
- [mode](/concepts/mode): "production", // string +
[mode](/concepts/mode): "production", // "production" | "development" | "none" + [mode](/concepts/mode): "production", // enable many optimizations for production builds + [mode](/concepts/mode): "development", // enabled useful tools for development + [mode](/concepts/mode): "none", // no defaults
// Chosen mode tells webpack to use its built-in optimizations accordingly. +
[entry](/configuration/entry-context#entry): "./app/entry", // string | object | array [entry](/configuration/entry-context#entry): ["./app/entry1", "./app/entry2"], [entry](/configuration/entry-context#entry): {