From 69c9cf9aeb1e458209b37469aa871fdbf8a86b09 Mon Sep 17 00:00:00 2001 From: Wee Date: Wed, 24 Apr 2019 01:55:03 +0800 Subject: [PATCH] fix(babel-plugin-export-metadata): transform to Unix slash (#825) transform Windows backslash to Unix slash --- other-packages/babel-plugin-export-metadata/src/index.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/other-packages/babel-plugin-export-metadata/src/index.js b/other-packages/babel-plugin-export-metadata/src/index.js index 4951174b7..ee4c63417 100644 --- a/other-packages/babel-plugin-export-metadata/src/index.js +++ b/other-packages/babel-plugin-export-metadata/src/index.js @@ -22,7 +22,11 @@ const replaceExportDefault = template(` const getFilename = state => { const filename = get(state, 'file.opts.filename') - return filename && path.relative(process.cwd(), filename) + let filePath = filename && path.relative(process.cwd(), filename) + if (process.platform === 'win32') { + filePath = filePath.split('\\').join('/') + } + return filePath } const findPathToInsert = path =>