From b6a3f83f22ae33b93532e8361b9171ae24c5e239 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicol=C3=B2=20Ribaudo?= Date: Wed, 23 Jun 2021 02:43:08 +0200 Subject: [PATCH] Fix `@babel/runtime` build on Windows --- .../babel-plugin-transform-runtime/scripts/build-dist.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/packages/babel-plugin-transform-runtime/scripts/build-dist.js b/packages/babel-plugin-transform-runtime/scripts/build-dist.js index db052f50012d..df6c0c96c1a1 100644 --- a/packages/babel-plugin-transform-runtime/scripts/build-dist.js +++ b/packages/babel-plugin-transform-runtime/scripts/build-dist.js @@ -127,7 +127,7 @@ function writeHelperFile( buildHelper(runtimeName, pkgDirname, fullPath, helperName, { esm, corejs }) ); - return `./${filePath}`; + return esm ? `./helpers/esm/${fileName}` : `./helpers/${fileName}`; } function writeHelpers(runtimeName, { corejs } = {}) { @@ -164,12 +164,13 @@ function writeHelpers(runtimeName, { corejs } = {}) { // - Node.js <13.2.0 will fail resolving the first array entry, and will // fallback to the second entry (the CJS file) // In Babel 8 we can simplify this. - helperSubExports[`./${helperPath}`] = [ + helperSubExports[`./${path.posix.join("helpers", helperName)}`] = [ { node: cjs, import: esm, default: cjs }, cjs, ]; // For backward compatibility. We can remove this in Babel 8. - helperSubExports[`./${path.join("helpers", "esm", helperName)}`] = esm; + helperSubExports[`./${path.posix.join("helpers", "esm", helperName)}`] = + esm; } writeHelperExports(runtimeName, helperSubExports);