I have a problem with making Parcel, Jest and Babel work with the same .babelrc
Parcel version: 1.11.0
Jest version: 24.0.0
Node: v10.5.0
Platform: Win 10
.babelrc
{
"env": {
"development": {
"plugins": [
[
"@babel/plugin-transform-runtime",
{
"corejs": 2
}
]
]
},
"test": {
}
},
}
If I move the plugins
section to the root of the JSON it works correctly with the web app, however Parcel or Babel for some reason can't recognize the development env even if I set it in the command line.
If run the tests without the environment setup (having the env
as above) then I get
({"Object.<anonymous>":function(module,exports,require,__dirname,__filename,global,jest){import _Promise from "@babel/runtime-corejs2/core-js/promise";
with Jest.
Probably the test setup wouldn't get recognized either, it just works without the babel/plugin-transform-runtime
Using this .babelrc
solved it:
{
"env": {
"production": {
"plugins": [
[
"@babel/plugin-transform-runtime",
{
"corejs": 2
}
]
]
},
"development": {
"plugins": [
[
"@babel/plugin-transform-runtime",
{
"corejs": 2
}
]
]
},
"test": {
"plugins": [
]
}
},
}