docs: update readme to add babel 7 instructions (#1274)
This commit is contained in:
parent
5560f72912
commit
fc93c05f68
1 changed files with 12 additions and 6 deletions
18
Readme.md
18
Readme.md
|
@ -161,16 +161,22 @@ Learn more about the application object in the [Application API Reference](docs/
|
|||
|
||||
## Babel setup
|
||||
|
||||
If you're not using `node v7.6+`, we recommend setting up `babel` with [`babel-preset-env`](https://github.com/babel/babel-preset-env):
|
||||
If you're not using `node v7.6+`, we recommend setting up `babel` with [`@babel/preset-env`](https://babeljs.io/docs/en/next/babel-preset-env):
|
||||
|
||||
```bash
|
||||
$ npm install babel-register babel-preset-env --save
|
||||
$ npm install @babel/register @babel/preset-env @babel/cli --save-dev
|
||||
```
|
||||
|
||||
Setup `babel-register` in your entry file:
|
||||
In development, you'll want to use [`@babel/register`](https://babeljs.io/docs/en/next/babel-register):
|
||||
|
||||
```js
|
||||
require('babel-register');
|
||||
```bash
|
||||
node --require @babel/register <your-entry-file>
|
||||
```
|
||||
|
||||
In production, you'll want to build your files with [`@babel/cli`](https://babeljs.io/docs/en/babel-cli). Suppose you are compiling a folder `src` and you wanted the output to go to a new folder `dist` with non-javascript files copied:
|
||||
|
||||
```bash
|
||||
babel src --out-dir dist --copy-files
|
||||
```
|
||||
|
||||
And have your `.babelrc` setup:
|
||||
|
@ -178,7 +184,7 @@ And have your `.babelrc` setup:
|
|||
```json
|
||||
{
|
||||
"presets": [
|
||||
["env", {
|
||||
["@babel/preset-env", {
|
||||
"targets": {
|
||||
"node": true
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue