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 = [