Update webpack guide with npm init

This commit is contained in:
Raphael Pierzina 2017-02-21 22:14:31 +00:00
parent 498569cee4
commit 09836f69db
1 changed files with 18 additions and 7 deletions

View File

@ -34,18 +34,29 @@ Now you need to configure webpack. The plugin expects a webpack project in the
### `package.json`
This file instructs `npm` which packages we will need. All we need for a
start is to create an almost empty file:
This file instructs `npm` which packages we will need.
Recent versions of `npm` require `name` and `version` fields in your
`package.json` (see [npm package.json docs
:ext](https://docs.npmjs.com/files/package.json)).
[npm-init :ext](https://docs.npmjs.com/cli/init) is a command-line tool to
interactively create a ``package.json`` file.
```
$ npm init
```
This will ask you a bunch of questions (invoke with ``--yes`` to use default
values) and then generate the file for you:
```json
{
"name": "foobar",
"name": "lektor-example",
"version": "0.1.0",
"private": true
"description": "",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "",
"license": "MIT"
}
```