From 1e25a2e857d3c92ad4b8382c6b3f4ec701e266e9 Mon Sep 17 00:00:00 2001 From: Mattias Ekstrand Date: Sat, 22 Jan 2022 16:22:52 +0100 Subject: [PATCH] Normalize absolute paths on Windows (#14187) Co-authored-by: Babel Bot --- .../src/get-runtime-path/index.ts | 2 +- .../test/fixtures/windows/absoluteRuntime/output.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/babel-plugin-transform-runtime/src/get-runtime-path/index.ts b/packages/babel-plugin-transform-runtime/src/get-runtime-path/index.ts index 28f6d7a82197..37fdc83a6827 100644 --- a/packages/babel-plugin-transform-runtime/src/get-runtime-path/index.ts +++ b/packages/babel-plugin-transform-runtime/src/get-runtime-path/index.ts @@ -34,5 +34,5 @@ function resolveAbsoluteRuntime(moduleName: string, dirname: string) { } export function resolveFSPath(path) { - return require.resolve(path); + return require.resolve(path).replace(/\\/g, "/"); } diff --git a/packages/babel-plugin-transform-runtime/test/fixtures/windows/absoluteRuntime/output.js b/packages/babel-plugin-transform-runtime/test/fixtures/windows/absoluteRuntime/output.js index b21448b570a6..452420d4b63b 100644 --- a/packages/babel-plugin-transform-runtime/test/fixtures/windows/absoluteRuntime/output.js +++ b/packages/babel-plugin-transform-runtime/test/fixtures/windows/absoluteRuntime/output.js @@ -1,4 +1,4 @@ -var _asyncToGenerator = require("\\packages\\babel-runtime\\helpers\\asyncToGenerator.js"); +var _asyncToGenerator = require("/packages/babel-runtime/helpers/asyncToGenerator.js"); function test() { return _test.apply(this, arguments);