Skip to content

Commit

Permalink
Fix @babel/runtime build on Windows
Browse files Browse the repository at this point in the history
  • Loading branch information
nicolo-ribaudo committed Jun 23, 2021
1 parent 55a1e5e commit b6a3f83
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions packages/babel-plugin-transform-runtime/scripts/build-dist.js
Expand Up @@ -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 } = {}) {
Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit b6a3f83

Please sign in to comment.