Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

includePaths should normalize path separator #42

Closed
ljani opened this issue Jan 26, 2022 · 1 comment · Fixed by #43
Closed

includePaths should normalize path separator #42

ljani opened this issue Jan 26, 2022 · 1 comment · Fixed by #43

Comments

@ljani
Copy link
Contributor

ljani commented Jan 26, 2022

I'm on Windows and tried to configure includePaths to only include ["./src"], but none of the files match.

If I console.log(filename, path.resolve(includePath)) here, I get the following output:

C:/devel/myblog/src/lib/components/Header.svelte C:\devel\myblog\src

Obviously filename.indexOf will fail. Thus either filename should be normalized to use backslashes or the result from path.resolve should be changed to use forward slashes.

PS. maybe consider breaking the forEach, when the first match is found? Also should this if be an else?

ljani added a commit to ljani/svelte-preprocess-cssmodules that referenced this issue Jan 26, 2022
Fixes micantoine#42 by normalizing includePaths to use forward slashes on Windows
too.

In addition, filenames are now expected to *start with* an includePath,
not only contain it. includePaths are now resolved ahead of time to
improve performance.
ljani added a commit to ljani/svelte-preprocess-cssmodules that referenced this issue Jan 26, 2022
Fixes micantoine#42 by normalizing includePaths to use forward slashes on Windows
too.

In addition, filenames are now expected to *start with* an includePath,
not only contain it. includePaths are now resolved ahead of time to
improve performance.
ljani added a commit to ljani/svelte-preprocess-cssmodules that referenced this issue Jan 26, 2022
Fixes micantoine#42 by normalizing includePaths to use forward slashes on Windows
too.

In addition, filenames are now expected to *start with* an includePath,
not only contain it. includePaths are now resolved ahead of time to
improve performance.
@micantoine
Copy link
Owner

Included in v2.1.3

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 a pull request may close this issue.

2 participants