Skip to content

Allow empty string as opts.root#56

Merged
madyankin merged 1 commit intomadyankin:masterfrom
srolel:patch-2
May 18, 2017
Merged

Allow empty string as opts.root#56
madyankin merged 1 commit intomadyankin:masterfrom
srolel:patch-2

Conversation

@srolel
Copy link
Copy Markdown
Contributor

@srolel srolel commented Jan 26, 2017

Correction for #55

@madyankin
Copy link
Copy Markdown
Owner

@mosho1 please add tests for this

@srolel
Copy link
Copy Markdown
Contributor Author

srolel commented Jan 26, 2017

That's a good idea. I played around with it (had to make the dev env run in windows) and it turns out the option isn't really useful outside setting it to '' on windows. I didn't want to break any existing functionality so I didn't change the default from '/' to an empty string.

The real problem, is that in css-module-loader-core/src/file-system-loader.j there is this line:

fileRelativePath = path.resolve( path.join( this.root, relativeDir ), newPath )

And for me, on windows, relativeDir (which comes from postcss's css.source.input.from) is actually an absolute path. I'm not sure how that works on other systems, but if the path.join is required on unix systems, maybe the better solution would be to detect windows and set the right value ('' rather than '/' automatically).

@madyankin madyankin merged commit e6b4ec0 into madyankin:master May 18, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants