diff --git a/src/utils/match-files.ts b/src/utils/match-files.ts index 420b077..4a9d187 100644 --- a/src/utils/match-files.ts +++ b/src/utils/match-files.ts @@ -36,6 +36,14 @@ export const matchFiles = async (ctx: LoaderContext, options: StyleResourcesLoad return partialFiles.filter(isStyleFile); }), ); - - return [...new Set(flatten(files))]; + /* + * Glob always return unix style file path which would have problems on Windows. + * For more details, see: https://github.com/yenshih/style-resources-loader/issues/17 + * + * Use path.resolve() method to convert the unix style file path to system compatible + * file path. + */ + const systemCompatibleFiles = flatten(files).map(file => path.resolve(file)); + + return [...new Set(systemCompatibleFiles)]; };