You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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
Copy file name to clipboardExpand all lines: src/content/guides/getting-started.md
+34-33Lines changed: 34 additions & 33 deletions
Original file line number
Diff line number
Diff line change
@@ -17,6 +17,7 @@ contributors:
17
17
- ATGardner
18
18
- ayvarot
19
19
- bjarki
20
+
- Spiral90210
20
21
---
21
22
22
23
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__
178
179
179
180
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.
180
181
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:
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/
200
201
```
201
202
202
203
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');
237
238
module.exports= {
238
239
entry:'./src/index.js',
239
240
output: {
240
-
filename:'bundle.js',
241
+
filename:'main.js',
241
242
path:path.resolve(__dirname, 'dist')
242
243
}
243
244
};
@@ -249,19 +250,19 @@ Now, let's run the build again but instead using our new configuration file:
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/
265
266
```
266
267
267
268
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:
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/
323
324
```
324
325
325
326
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`.
0 commit comments