Skip to content

Commit fc93c05

Browse files
vikr01dead-horse
authored andcommitted
docs: update readme to add babel 7 instructions (#1274)
1 parent 5560f72 commit fc93c05

File tree

1 file changed

+12
-6
lines changed

1 file changed

+12
-6
lines changed

Readme.md

+12-6
Original file line numberDiff line numberDiff line change
@@ -161,24 +161,30 @@ Learn more about the application object in the [Application API Reference](docs/
161161

162162
## Babel setup
163163

164-
If you're not using `node v7.6+`, we recommend setting up `babel` with [`babel-preset-env`](https://github.com/babel/babel-preset-env):
164+
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):
165165

166166
```bash
167-
$ npm install babel-register babel-preset-env --save
167+
$ npm install @babel/register @babel/preset-env @babel/cli --save-dev
168168
```
169169

170-
Setup `babel-register` in your entry file:
170+
In development, you'll want to use [`@babel/register`](https://babeljs.io/docs/en/next/babel-register):
171171

172-
```js
173-
require('babel-register');
172+
```bash
173+
node --require @babel/register <your-entry-file>
174+
```
175+
176+
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:
177+
178+
```bash
179+
babel src --out-dir dist --copy-files
174180
```
175181

176182
And have your `.babelrc` setup:
177183

178184
```json
179185
{
180186
"presets": [
181-
["env", {
187+
["@babel/preset-env", {
182188
"targets": {
183189
"node": true
184190
}

0 commit comments

Comments
 (0)