WearyMonkey / ngtemplate-loader

Include AngularJS templates in the Webpack bundle and preload the template cache.
MIT License
238 stars 78 forks source link

Generated file path is causing problems on Windows #61

Closed zaalbarxx closed 7 years ago

zaalbarxx commented 7 years ago

Hi! I've found one problem with the current method of generating the key for template in cache. Given app/component/include.html and this code var filePath = path.join(prefix, resource.slice(relativeToIndex + relativeTo.length)) on Windows the generated key will be app\component\include.html which seems to be bad since I suppose that all template keys should have URL-like separator which is /. Wouldn't it be better to always translate the final path to the one with / as separator ? Like: var filePath = path.join(prefix, resource.slice(relativeToIndex + relativeTo.length)).replace(pathSepRegex, pathSep); I am open for discussion :)

anandhasubha commented 7 years ago

Facing the same problem. Though I work on Windows, I am requiring all files in unix style paths since the target machine for deployment is linux. However path.join overwrites the forward-slash '/' with backward-slash '\'. var filePath = path.join(prefix, resource.slice(relativeToIndex + relativeTo.length)) -- line# 41 in index.js Is there a work-around?