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);