diff --git a/other-packages/babel-plugin-export-metadata/src/index.js b/other-packages/babel-plugin-export-metadata/src/index.js index 6859d122c..f6e0e8021 100644 --- a/other-packages/babel-plugin-export-metadata/src/index.js +++ b/other-packages/babel-plugin-export-metadata/src/index.js @@ -22,7 +22,9 @@ const replaceExportDefault = template(` const getFilename = state => { const rootDir = get(state, 'opts.root', process.cwd()) const filename = get(state, 'file.opts.filename') - return filename && path.relative(rootDir, filename) + let filePath = filename && path.relative(process.cwd(), filename) + if (process.platform === 'win32') filePath = filePath.split('\\').join('/') + return filePath } const findPathToInsert = path =>