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` ### `package.json`
This file instructs `npm` which packages we will need. All we need for a This file instructs `npm` which packages we will need.
start is to create an almost empty file:
Recent versions of `npm` require `name` and `version` fields in your [npm-init :ext](https://docs.npmjs.com/cli/init) is a command-line tool to
`package.json` (see [npm package.json docs interactively create a ``package.json`` file.
:ext](https://docs.npmjs.com/files/package.json)).
```
$ 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 ```json
{ {
"name": "foobar", "name": "lektor-example",
"version": "0.1.0", "version": "0.1.0",
"private": true "description": "",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "",
"license": "MIT"
} }
``` ```