Skip to content

Commit 84038e4

Browse files
committed
Add support to transpile import/export syntax
next/babel doesn't transpile import/export. So, we need to do it explicitly, but only for test env.
1 parent 9348762 commit 84038e4

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)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy