Skip to content

Commit f870f27

Browse files
Spiral90210montogeek
authored andcommitted
docs(guides) Making the examples consistent on Getting started (#2259)
* Making the examples consistent. There was some inconsistency between referring to main.js in the html file, and bundle.js on other places. I assume that the default in previous versions was bundle.js, however following the examples with console output, webpack uses main.js, so I have updated the examples to reflect this, as it reflected quite badly that the getting started instructions followed exactly as examples presented wouldn't actually work. Happy to have my name removed as a contributed if deemed necessary, it's only a small change after all. * Restoring/removing line breakes after missed before PR, also changed the wording of a sentence to remove brackets and make the intent clearer * Removing yet more line breaks that were unintentionally added * Correct a directory naming error, and removing redundant text
1 parent 6c3cadb commit f870f27

File tree

1 file changed

+34
-33
lines changed

1 file changed

+34
-33
lines changed

src/content/guides/getting-started.md

Lines changed: 34 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ contributors:
1717
- ATGardner
1818
- ayvarot
1919
- bjarki
20+
- Spiral90210
2021
---
2122

2223
Webpack is used to compile JavaScript modules. Once [installed](/guides/installation), you can interface with webpack either from its [CLI](/api/cli) or [API](/api/node). If you're still new to webpack, please read through the [core concepts](/concepts) and [this comparison](/comparison) to learn why you might use it over the other tools that are out in the community.
@@ -178,25 +179,25 @@ __dist/index.html__
178179

179180
In this setup, `index.js` explicitly requires `lodash` to be present, and binds it as `_` (no global scope pollution). By stating what dependencies a module needs, webpack can use this information to build a dependency graph. It then uses the graph to generate an optimized bundle where scripts will be executed in the correct order.
180181

181-
With that said, let's run `npx webpack` with our script as the [entry point](/concepts/entry-points) and `main.js` as the [output](/concepts/output). The `npx` command, which ships with Node 8.2 or higher, runs the webpack binary (`./node_modules/.bin/webpack`) of the webpack package we installed in the beginning:
182+
With that said, let's run `npx webpack`, which will take our script at `src/index.js` as the [entry point](/concepts/entry-points), and will generate `dist/main.js` as the [output](/concepts/output).. The `npx` command, which ships with Node 8.2 or higher, runs the webpack binary (`./node_modules/.bin/webpack`) of the webpack package we installed in the beginning:
182183

183184
``` bash
184185
npx webpack
185186

186187
Hash: dabab1bac2b940c1462b
187-
Version: webpack 4.0.1
188-
Time: 3003ms
189-
Built at: 2018-2-26 22:42:11
190-
Asset Size Chunks Chunk Names
191-
main.js 69.6 KiB 0 [emitted] main
192-
Entrypoint main = main.js
193-
[1] (webpack)/buildin/module.js 519 bytes {0} [built]
194-
[2] (webpack)/buildin/global.js 509 bytes {0} [built]
195-
[3] ./src/index.js 256 bytes {0} [built]
188+
Version: webpack 4.12.0
189+
Time: 287ms
190+
Built at: 13/06/2018 11:52:07
191+
Asset Size Chunks Chunk Names
192+
main.js 70.4 KiB 0 [emitted] main
193+
[1] (webpack)/buildin/module.js 497 bytes {0} [built]
194+
[2] (webpack)/buildin/global.js 489 bytes {0} [built]
195+
[3] ./src/index.js 216 bytes {0} [built]
196196
+ 1 hidden module
197197

198198
WARNING in configuration
199-
The 'mode' option has not been set. Set 'mode' option to 'development' or 'production' to enable defaults for this environment.
199+
The 'mode' option has not been set, webpack will fallback to 'production' for this value. Set 'mode' option to 'development' or 'production' to enable defaults for each environment.
200+
You can also set it to 'none' to disable any default behavior. Learn more: https://webpack.js.org/concepts/mode/
200201
```
201202

202203
T> Your output may vary a bit, but if the build is successful then you are good to go. Also, don't worry about the warning, we'll tackle that later.
@@ -237,7 +238,7 @@ const path = require('path');
237238
module.exports = {
238239
entry: './src/index.js',
239240
output: {
240-
filename: 'bundle.js',
241+
filename: 'main.js',
241242
path: path.resolve(__dirname, 'dist')
242243
}
243244
};
@@ -249,19 +250,19 @@ Now, let's run the build again but instead using our new configuration file:
249250
npx webpack --config webpack.config.js
250251

251252
Hash: dabab1bac2b940c1462b
252-
Version: webpack 4.0.1
253-
Time: 328ms
254-
Built at: 2018-2-26 22:47:43
255-
Asset Size Chunks Chunk Names
256-
bundle.js 69.6 KiB 0 [emitted] main
257-
Entrypoint main = bundle.js
258-
[1] (webpack)/buildin/module.js 519 bytes {0} [built]
259-
[2] (webpack)/buildin/global.js 509 bytes {0} [built]
260-
[3] ./src/index.js 256 bytes {0} [built]
253+
Version: webpack 4.12.0
254+
Time: 283ms
255+
Built at: 13/06/2018 11:53:51
256+
Asset Size Chunks Chunk Names
257+
main.js 70.4 KiB 0 [emitted] main
258+
[1] (webpack)/buildin/module.js 497 bytes {0} [built]
259+
[2] (webpack)/buildin/global.js 489 bytes {0} [built]
260+
[3] ./src/index.js 216 bytes {0} [built]
261261
+ 1 hidden module
262262

263263
WARNING in configuration
264-
The 'mode' option has not been set. Set 'mode' option to 'development' or 'production' to enable defaults for this environment.
264+
The 'mode' option has not been set, webpack will fallback to 'production' for this value. Set 'mode' option to 'development' or 'production' to enable defaults for each environment.
265+
You can also set it to 'none' to disable any default behavior. Learn more: https://webpack.js.org/concepts/mode/
265266
```
266267

267268
W> Note that when calling `webpack` via its path on windows, you must use backslashes instead, e.g. `node_modules\.bin\webpack --config webpack.config.js`.
@@ -307,19 +308,19 @@ Now run the following command and see if your script alias works:
307308
npm run build
308309

309310
Hash: dabab1bac2b940c1462b
310-
Version: webpack 4.0.1
311-
Time: 323ms
312-
Built at: 2018-2-26 22:50:25
313-
Asset Size Chunks Chunk Names
314-
bundle.js 69.6 KiB 0 [emitted] main
315-
Entrypoint main = bundle.js
316-
[1] (webpack)/buildin/module.js 519 bytes {0} [built]
317-
[2] (webpack)/buildin/global.js 509 bytes {0} [built]
318-
[3] ./src/index.js 256 bytes {0} [built]
311+
Version: webpack 4.12.0
312+
Time: 278ms
313+
Built at: 13/06/2018 11:54:54
314+
Asset Size Chunks Chunk Names
315+
main.js 70.4 KiB 0 [emitted] main
316+
[1] (webpack)/buildin/module.js 497 bytes {0} [built]
317+
[2] (webpack)/buildin/global.js 489 bytes {0} [built]
318+
[3] ./src/index.js 216 bytes {0} [built]
319319
+ 1 hidden module
320320

321321
WARNING in configuration
322-
The 'mode' option has not been set. Set 'mode' option to 'development' or 'production' to enable defaults for this environment.
322+
The 'mode' option has not been set, webpack will fallback to 'production' for this value. Set 'mode' option to 'development' or 'production' to enable defaults for each environment.
323+
You can also set it to 'none' to disable any default behavior. Learn more: https://webpack.js.org/concepts/mode/
323324
```
324325

325326
T> Custom parameters can be passed to webpack by adding two dashes between the `npm run build` command and your parameters, e.g. `npm run build -- --colors`.
@@ -336,7 +337,7 @@ webpack-demo
336337
|- package.json
337338
|- webpack.config.js
338339
|- /dist
339-
|- bundle.js
340+
|- main.js
340341
|- index.html
341342
|- /src
342343
|- index.js

0 commit comments

Comments
 (0)