Skip to content

Commit 7f660e7

Browse files
committed
Merge pull request css-modules#5 from rtsao/fix-relative-paths
Fixed relative paths
2 parents eef3868 + bbcce9e commit 7f660e7

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/file-system-loader.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,9 @@ export default class FileSystemLoader {
3131
let newPath = _newPath.replace( /^["']|["']$/g, "" ),
3232
trace = _trace || String.fromCharCode( this.importNr++ )
3333
return new Promise( ( resolve, reject ) => {
34-
let rootRelativePath = path.resolve( path.dirname( relativeTo ), newPath ),
35-
fileRelativePath = this.root + rootRelativePath
34+
let relativeDir = path.dirname( relativeTo ),
35+
rootRelativePath = path.resolve( relativeDir, newPath ),
36+
fileRelativePath = path.resolve( path.join( this.root, relativeDir ), newPath )
3637

3738
fs.readFile( fileRelativePath, "utf-8", ( err, source ) => {
3839
if ( err ) reject( err )

0 commit comments

Comments
 (0)