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

The partial templates/Layout/Main.hbs could not be found Window 10 #15

Closed
fazdiu opened this issue Apr 26, 2023 · 0 comments
Closed

The partial templates/Layout/Main.hbs could not be found Window 10 #15

fazdiu opened this issue Apr 26, 2023 · 0 comments
Labels
bug Something isn't working
Milestone

Comments

@fazdiu
Copy link

fazdiu commented Apr 26, 2023

I took the same example from handlebars.js from their repository and started the project on a Windows 10 PC. The problem is when trying to include the templates it gives me this error:

[plugin:@vituum/vite-plugin-handlebars] The partial templates/Layout/Main.hbs could not be found

Seems to be a windows problem with paths and backslashes.

the problem seems to be from the @vituum/vite-plugin-handlebars package in this line of code:
const partialGlob = !options.partials.directory ? ${options.root}/**/*.hbs : ${resolve(process.cwd(), options.partials.directory)}/**/*.hbs

and the solution seems to normalize the path:
const partialGlob = (!options.partials.directory ? ${options.root}/**/*.hbs : ${resolve(process.cwd(), options.partials.directory)}/**/*.hbs).replace(/\\/g, '/')
const partialName = relative(partialDir, path).replace(/\\/g, '/')

please need to update the package as soon as possible. Thank you for reading.

@lubomirblazekcz lubomirblazekcz added the bug Something isn't working label Jun 14, 2023
@lubomirblazekcz lubomirblazekcz added this to the 1.0 milestone Jun 14, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants