Skip to content

Commit 2b737d0

Browse files
Zicraelmontogeek
authored andcommitted
docs(guides) Fix error with filename + npm package. (#1886)
1) Webpack as default build to file main.js , not on bundle.js. 2) Add npm install webpack-cli -D to npm install, If you do not do this console throw next: ====================================================== The CLI moved into a separate package: webpack-cli. Please install 'webpack-cli' in addition to webpack itself to use the CLI. -> When using npm: npm install webpack-cli -D -> When using yarn: yarn add webpack-cli -D ====================================================== So pls fix this, thank`s.
1 parent 6fa39c0 commit 2b737d0

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

src/content/guides/getting-started.md

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ First let's create a directory, initialize npm, [install webpack locally](/guide
2525
``` bash
2626
mkdir webpack-demo && cd webpack-demo
2727
npm init -y
28+
npm install --save-dev webpack
2829
npm install webpack webpack-cli --save-dev
2930
```
3031

@@ -167,14 +168,14 @@ __dist/index.html__
167168
</head>
168169
<body>
169170
- <script src="./src/index.js"></script>
170-
+ <script src="dist/bundle.js"></script>
171+
+ <script src="main.js"></script>
171172
</body>
172173
</html>
173174
```
174175

175176
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.
176177

177-
With that said, let's run `npx webpack` with our script as the [entry point](/concepts/entry-points) and `bundle.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:
178+
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:
178179

179180
``` bash
180181
npx webpack
@@ -184,8 +185,8 @@ Version: webpack 4.0.1
184185
Time: 3003ms
185186
Built at: 2018-2-26 22:42:11
186187
Asset Size Chunks Chunk Names
187-
bundle.js 69.6 KiB 0 [emitted] main
188-
Entrypoint main = bundle.js
188+
main.js 69.6 KiB 0 [emitted] main
189+
Entrypoint main = main.js
189190
[1] (webpack)/buildin/module.js 519 bytes {0} [built]
190191
[2] (webpack)/buildin/global.js 509 bytes {0} [built]
191192
[3] ./src/index.js 256 bytes {0} [built]

0 commit comments

Comments
 (0)