From 133325845983204e217b9f363296e73e3ce870e6 Mon Sep 17 00:00:00 2001 From: XiaoYan Li Date: Thu, 27 Sep 2018 04:51:26 +0800 Subject: [PATCH] Add dynamic import transformer for dependencies in test env --- packages/babel-preset-react-app/dependencies.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/packages/babel-preset-react-app/dependencies.js b/packages/babel-preset-react-app/dependencies.js index 6c8e431f985..a3c9501f11f 100644 --- a/packages/babel-preset-react-app/dependencies.js +++ b/packages/babel-preset-react-app/dependencies.js @@ -107,6 +107,9 @@ module.exports = function(api, opts) { ], // Adds syntax support for import() require('@babel/plugin-syntax-dynamic-import').default, + isEnvTest && + // Transform dynamic import to require + require('babel-plugin-transform-dynamic-import').default, ].filter(Boolean), }; };