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) 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.
Copy file name to clipboardExpand all lines: src/content/guides/getting-started.md
+5-4Lines changed: 5 additions & 4 deletions
Original file line number
Diff line number
Diff line change
@@ -25,6 +25,7 @@ First let's create a directory, initialize npm, [install webpack locally](/guide
25
25
```bash
26
26
mkdir webpack-demo &&cd webpack-demo
27
27
npm init -y
28
+
npm install --save-dev webpack
28
29
npm install webpack webpack-cli --save-dev
29
30
```
30
31
@@ -167,14 +168,14 @@ __dist/index.html__
167
168
</head>
168
169
<body>
169
170
- <script src="./src/index.js"></script>
170
-
+ <script src="dist/bundle.js"></script>
171
+
+ <script src="main.js"></script>
171
172
</body>
172
173
</html>
173
174
```
174
175
175
176
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.
176
177
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:
0 commit comments