diff --git a/src/utils/relativeId.js b/src/utils/relativeId.js index e26bd02..f6ffdeb 100644 --- a/src/utils/relativeId.js +++ b/src/utils/relativeId.js @@ -1,4 +1,6 @@ +import { isAbsolute, relative } from './path.js'; + export default function relativeId ( id ) { - if ( typeof process === 'undefined' ) return id; - return id.replace( process.cwd(), '' ).replace( /^[\/\\]/, '' ); + if ( typeof process === 'undefined' || !isAbsolute( id ) ) return id; + return relative( process.cwd(), id ); }