Skip to content

Commit

Permalink
fix(babel-plugin-export-metadata): transform to Unix slash (doczjs#825)
Browse files Browse the repository at this point in the history
transform Windows backslash to Unix slash
  • Loading branch information
fi3ework committed Apr 23, 2019
1 parent f7cc750 commit 69c9cf9
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion other-packages/babel-plugin-export-metadata/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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('/')

This comment has been minimized.

Copy link
@shmidt-i

shmidt-i Sep 6, 2019

path.normalize probably will do this thing?

This comment has been minimized.

Copy link
@jesperorb

jesperorb Oct 3, 2019

@shmidt-i path.normalize normalize to windows normal on windows and regular normal on everyting else :D which means that it will still use backslash on windows.

}
return filePath
}

const findPathToInsert = path =>
Expand Down

0 comments on commit 69c9cf9

Please sign in to comment.