diff --git a/CHANGELOG.md b/CHANGELOG.md
index c7969d1..3ba9878 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,3 +1,6 @@
+# Next
+* switch from babel-preset-es2015 to babel-preset-env
+
# v0.10.4 (2017-10-13)
* Fixed bug preventing the use of arrays for the Express views setting
diff --git a/README.md b/README.md
index b5d0265..77236aa 100644
--- a/README.md
+++ b/README.md
@@ -34,7 +34,7 @@ option | values | default
`doctype` | any string that can be used as [a doctype](http://en.wikipedia.org/wiki/Document_type_declaration), this will be prepended to your document | `""`
`beautify` | `true`: beautify markup before outputting (note, this can affect rendering due to additional whitespace) | `false`
`transformViews` | `true`: use `babel` to apply JSX, ESNext transforms to views.
**Note:** if already using `babel-register` in your project, you should set this to `false` | `true`
-`babel` | any object containing valid Babel options
**Note:** does not merge with defaults | `{presets: ['react', 'es2015']}`
+`babel` | any object containing valid Babel options
**Note:** does not merge with defaults | `{presets: ['react', [ "env", {"targets": {"node": "current"}}]]}`
The defaults are sane, but just in case you want to change something, here's how it would look:
@@ -46,7 +46,7 @@ app.engine('jsx', require('express-react-views').createEngine(options));
### Views
-Under the hood, [Babel][babel] is used to compile your views into ES5 friendly code, using the [react][babel-preset-react] and [es2015][babel-preset-es2015] presets by default. Only the files in your `views` directory (i.e. `app.set('views', __dirname + '/views')`) will be compiled.
+Under the hood, [Babel][babel] is used to compile your views to code compatible with your current node version, using the [react][babel-preset-react] and [env][babel-preset-env] presets by default. Only the files in your `views` directory (i.e. `app.set('views', __dirname + '/views')`) will be compiled.
Your views should be node modules that export a React component. Let's assume you have this file in `views/index.jsx`:
@@ -156,6 +156,10 @@ All "locals" are exposed to your view in `this.props`. These should work identic
* It's not possible to specify a doctype in JSX. You can override the default HTML5 doctype in the options.
+## Contributors
+* [Zpao][zpao] (Author)
+* [Venkat Reddy][svenkatreddy]
+
[express]: http://expressjs.com/
[react]: http://facebook.github.io/react/
[jade]: http://jade-lang.com/
@@ -163,4 +167,6 @@ All "locals" are exposed to your view in `this.props`. These should work identic
[hbs]: https://github.com/barc/express-hbs
[babel]: https://babeljs.io/
[babel-preset-react]: https://babeljs.io/docs/plugins/preset-react/
-[babel-preset-es2015]: https://babeljs.io/docs/plugins/preset-es2015/
+[babel-preset-env]: https://babeljs.io/docs/plugins/preset-env/
+[zpao]: https://github.com/zpao
+[svenkatreddy]: https://github.com/svenkatreddy
\ No newline at end of file
diff --git a/examples/dynamic/.babelrc b/examples/dynamic/.babelrc
new file mode 100644
index 0000000..48ee9b2
--- /dev/null
+++ b/examples/dynamic/.babelrc
@@ -0,0 +1,6 @@
+{
+ "presets": [
+ "react",
+ "env"
+ ]
+}
\ No newline at end of file
diff --git a/examples/dynamic/package.json b/examples/dynamic/package.json
index 9c5e96e..3c8d442 100644
--- a/examples/dynamic/package.json
+++ b/examples/dynamic/package.json
@@ -5,10 +5,10 @@
"author": "Chris Johnson ",
"private": true,
"scripts": {
- "start": "browserify -t [ babelify --presets [ es2015 react ] --standalone main views/main.js -o public/main.js ] && node app.js"
+ "start": "browserify -t babelify views/main.js --standalone main -o public/main.js && node app.js"
},
"dependencies": {
- "babel-preset-es2015": "^6.24.1",
+ "babel-preset-env": "^1.6.0",
"babel-preset-react": "^6.24.1",
"babelify": "^7.3.0",
"browserify": "^14.3.0",
diff --git a/index.js b/index.js
index d1eea3a..63c42fa 100644
--- a/index.js
+++ b/index.js
@@ -20,7 +20,11 @@ var DEFAULT_OPTIONS = {
babel: {
presets: [
'react',
- 'es2015',
+ [ "env", {
+ "targets": {
+ "node": "current",
+ },
+ }],
],
},
};
diff --git a/package.json b/package.json
index 607d2e9..2390b08 100644
--- a/package.json
+++ b/package.json
@@ -22,7 +22,7 @@
"react-dom": "^0.14.0 || ^15.0.0 || ^16.0.0"
},
"dependencies": {
- "babel-preset-es2015": "^6.24.1",
+ "babel-preset-env": "^1.6.0",
"babel-preset-react": "^6.24.1",
"babel-register": "^6.26.0",
"js-beautify": "^1.7.3",