Skip to content
This repository was archived by the owner on Jan 31, 2023. It is now read-only.

Commit a71f5dd

Browse files
Merge pull request #15 from cypress-io/issue-14-expand-js-features
feat: Expand babel plugins/presets to support commonly used experimental features
2 parents c6c5851 + 4b67389 commit a71f5dd

File tree

4 files changed

+120
-8
lines changed

4 files changed

+120
-8
lines changed

README.md

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,8 +79,16 @@ If you pass one of the top-level options in (`extensions`, `transform`, etc), it
7979
{
8080
ast: false,
8181
babelrc: false,
82-
plugins: ['babel-plugin-add-module-exports'],
83-
presets: ['@babel/preset-env', '@babel/preset-react']
82+
plugins: [
83+
'babel-plugin-add-module-exports'
84+
'@babel/plugin-proposal-class-properties',
85+
'@babel/plugin-proposal-object-rest-spread',
86+
'@babel/plugin-transform-runtime',
87+
],
88+
presets: [
89+
'@babel/preset-env',
90+
'@babel/preset-react',
91+
]
8492
},
8593
]
8694
],

index.js

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,20 @@ const defaultOptions = {
2727
ast: false,
2828
babelrc: false,
2929
// irons out differents between ES6 modules and node exports
30-
plugins: ['babel-plugin-add-module-exports'].map(require.resolve),
31-
// babel-preset-env supports any JS that's stage-4, meaning it's
32-
// completely finalized in the ECMA standard
33-
presets: ['@babel/preset-env', '@babel/preset-react'].map(require.resolve),
30+
plugins: [
31+
...[
32+
'babel-plugin-add-module-exports',
33+
'@babel/plugin-proposal-class-properties',
34+
'@babel/plugin-proposal-object-rest-spread',
35+
].map(require.resolve),
36+
[require.resolve('@babel/plugin-transform-runtime'), {
37+
moduleName: path.dirname(require.resolve('@babel/runtime/package')),
38+
}],
39+
],
40+
presets: [
41+
'@babel/preset-env',
42+
'@babel/preset-react',
43+
].map(require.resolve),
3444
},
3545
],
3646
],

package-lock.json

Lines changed: 92 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,8 +59,12 @@
5959
},
6060
"dependencies": {
6161
"@babel/core": "7.0.0-beta.55",
62+
"@babel/plugin-proposal-class-properties": "7.0.0-beta.55",
63+
"@babel/plugin-proposal-object-rest-spread": "7.0.0-beta.55",
64+
"@babel/plugin-transform-runtime": "7.0.0-beta.55",
6265
"@babel/preset-env": "7.0.0-beta.55",
6366
"@babel/preset-react": "7.0.0-beta.55",
67+
"@babel/runtime": "7.0.0-beta.55",
6468
"babel-plugin-add-module-exports": "0.2.1",
6569
"babelify": "9.0.0",
6670
"bluebird": "3.5.1",

0 commit comments

Comments
 (0)