From 88868af4bafa430b22d9a4ef7db929fd8e59efb5 Mon Sep 17 00:00:00 2001 From: Eric Dobbertin Date: Tue, 26 Nov 2019 15:12:49 -0600 Subject: [PATCH] chore: fix Babel config for tests Signed-off-by: Eric Dobbertin --- babel.config.js | 39 +++++++++++++++++---------------------- 1 file changed, 17 insertions(+), 22 deletions(-) diff --git a/babel.config.js b/babel.config.js index 9ca1b9795..e3903bc3f 100644 --- a/babel.config.js +++ b/babel.config.js @@ -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 { @@ -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", @@ -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 = [