Skip to content

Commit

Permalink
chore: fix Babel config for tests
Browse files Browse the repository at this point in the history
Signed-off-by: Eric Dobbertin <[email protected]>
  • Loading branch information
aldeed committed Nov 26, 2019
1 parent 22bc458 commit 88868af
Showing 1 changed file with 17 additions and 22 deletions.
39 changes: 17 additions & 22 deletions babel.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,22 @@
module.exports = function (api) {
const isTest = api.env("test");

// We set this in the `build:modules` package.json script
const esmodules = process.env.BABEL_MODULES === "1";

const plugins = [
"babel-plugin-styled-components",
["@babel/plugin-proposal-decorators", { legacy: true }],
["@babel/plugin-proposal-class-properties", { loose: true }],
"@babel/plugin-syntax-dynamic-import",
[
"@babel/plugin-transform-runtime",
{
useESModules: esmodules
}
]
];

// Config for when running Jest tests
if (isTest) {
return {
Expand All @@ -23,18 +39,10 @@ module.exports = function (api) {
],
"@babel/preset-react"
],
plugins: [
"babel-plugin-styled-components",
["@babel/plugin-proposal-decorators", { legacy: true }],
["@babel/plugin-proposal-class-properties", { loose: true }],
"@babel/plugin-syntax-dynamic-import"
]
plugins
};
}

// We set this in the `build:modules` package.json script
const esmodules = process.env.BABEL_MODULES === "1";

const presets = [
[
"@babel/env",
Expand Down Expand Up @@ -63,19 +71,6 @@ module.exports = function (api) {
"@babel/preset-react"
];

const plugins = [
"babel-plugin-styled-components",
["@babel/plugin-proposal-decorators", { legacy: true }],
["@babel/plugin-proposal-class-properties", { loose: true }],
"@babel/plugin-syntax-dynamic-import",
[
"@babel/plugin-transform-runtime",
{
useESModules: esmodules
}
]
];

let ignore;
if (process.env.NODE_ENV === "production") {
ignore = [
Expand Down

0 comments on commit 88868af

Please sign in to comment.