Skip to content

Commit bdcb0f7

Browse files
authored
Add support to transpile import/export syntax (#1044)
next/babel doesn't transpile import/export. So, we need to do it explicitly, but only for test env.
1 parent 9348762 commit bdcb0f7

File tree

2 files changed

+16
-5
lines changed

2 files changed

+16
-5
lines changed

examples/with-jest/.babelrc

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,15 @@
11
{
2-
"presets": ["next/babel"]
2+
"env": {
3+
"development": {
4+
"presets": ["next/babel"]
5+
},
6+
"production": {
7+
"presets": ["next/babel"]
8+
},
9+
"test": {
10+
// next/babel does not transpile import/export syntax.
11+
// So, using es2015 in the beginning will fix that.
12+
"presets": ["es2015", "next/babel"]
13+
}
14+
}
315
}

examples/with-jest/package.json

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,8 @@
1515
"babel-jest": "^18.0.0",
1616
"enzyme": "^2.5.1",
1717
"jest-cli": "^18.0.0",
18-
"react": "^15.3.2",
19-
"react-addons-test-utils": "^15.3.2",
20-
"react-dom": "^15.3.2",
21-
"react-test-renderer": "^15.4.1"
18+
"react-addons-test-utils": "^15.4.2",
19+
"babel-preset-es2015": "^6.22.0",
20+
"react-test-renderer": "^15.4.2"
2221
}
2322
}

0 commit comments

Comments
 (0)