Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update readme to add babel 7 instructions #1274

Merged
merged 1 commit into from Dec 7, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
18 changes: 12 additions & 6 deletions Readme.md
Expand Up @@ -161,24 +161,30 @@ 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:

```json
{
"presets": [
["env", {
["@babel/preset-env", {
"targets": {
"node": true
}
Expand Down