Skip to content

Commit ed2c560

Browse files
committed
Get started: do not rely on global installation
Since we do not recommend a global webpack installation, do not rely on it in the getting started guide
1 parent ef7342d commit ed2c560

File tree

2 files changed

+15
-11
lines changed

2 files changed

+15
-11
lines changed

content/get-started/index.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ contributors:
77
- cntanglijun
88
- chrisVillanueva
99
- johnstew
10+
- simon04
1011
---
1112

1213
webpack is a tool to build JavaScript modules in your application. To start using `webpack` from its [cli](/api/cli) or [api](/api/node), follow the [Installation instructions](/get-started/install-webpack).
@@ -104,7 +105,7 @@ By stating what dependencies a module needs, webpack can use this information to
104105
Now run `webpack` on this folder with `index.js` as the entry file and `bundle.js` as the output file in which all code required for the page is bundled.
105106

106107
```bash
107-
webpack app/index.js dist/bundle.js
108+
./node_modules/.bin/webpack app/index.js dist/bundle.js
108109

109110
Hash: a3c861a7d42fc8944524
110111
Version: webpack 2.2.0
@@ -116,7 +117,7 @@ index.js 1.56 kB 0 [emitted] main
116117
```
117118
T> Output may vary. If the build is successful then you are good to go.
118119

119-
T> If you created a local `webpack@beta` build, be sure to reference `webpack` with `./node_modules/.bin/webpack` on the command line.
120+
T> If you [installed webpack globally](/get-started/install-webpack#global-installation), you have to invoke webpack using `webpack`.
120121

121122
Open `index.html` in your browser to see the result of a successful bundle.
122123
You should see a page with the following text: 'Hello webpack'.

content/get-started/install-webpack.md

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -12,15 +12,7 @@ Before getting started, make sure you have a fresh version of [Node.js](https://
1212

1313
Note that this documentation is for webpack 2, for which there is not yet a stable release. You can get the most recent beta by installing with the `beta` tag (see below).
1414

15-
### Global Installation
16-
17-
``` bash
18-
npm install webpack@beta -g
19-
```
20-
21-
The `webpack` command is now available globally.
22-
23-
However, this is not a recommended practice. This locks you down to a specific version of webpack and might fail in projects that use a different version. The next section tells you how to install webpack locally in a project.
15+
The next section tells you how to install webpack locally in a project.
2416

2517
### Local Installation
2618

@@ -43,6 +35,17 @@ This is standard and recommended practice.
4335
T> To run the local installation of webpack you can access its bin version as `node_modules/.bin/webpack`
4436

4537

38+
### Global Installation
39+
40+
W> Note that a global webpack installation is not a recommended practice. This locks you down to a specific version of webpack and might fail in projects that use a different version.
41+
42+
``` bash
43+
npm install webpack@beta -g
44+
```
45+
46+
The `webpack` command is now available globally.
47+
48+
4649
### Bleeding Edge
4750

4851
If you are enthusiastic about using the latest that webpack has to offer (beware - may be unstable), you can install directly from the webpack repository using

0 commit comments

Comments
 (0)