From c250d5aa7ed1eaa346235d8182587aa6a4afd906 Mon Sep 17 00:00:00 2001 From: Clemence Kyara Date: Wed, 4 Sep 2024 13:25:51 +0300 Subject: [PATCH] Temporary fix for import assertions/attributes collision https://github.com/babel/babel/issues/16798#issuecomment-2326220768 --- packages/jest-config-commons-ui/next.js | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/packages/jest-config-commons-ui/next.js b/packages/jest-config-commons-ui/next.js index b4542b382..8428a9903 100644 --- a/packages/jest-config-commons-ui/next.js +++ b/packages/jest-config-commons-ui/next.js @@ -21,7 +21,18 @@ module.exports = { "^.+\\.(js|jsx|ts|tsx)$": [ "babel-jest", { - presets: ["next/babel"], + sourceType: "unambiguous", + targets: { node: process.versions.node }, + // Can't use presets: ["next/babel"] here + // https://github.com/babel/babel/issues/16798#issuecomment-2326220768 + // In short, next/babel is bundling old versions of babel that don't have the + // import assertions/attributes fix. + // 🤞🏽 this will be sorted in the next.js release + presets: [ + "@babel/preset-env", + // or runtime: 'classic', depending on which one you are using + ["@babel/preset-react", { development: true, runtime: "automatic" }], + ], plugins: ["@babel/plugin-transform-private-methods"], }, ],