-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Template helpers fail on relative paths #1597
Comments
It should be a relative or absolute which means starting with '/' or './'. Let me know if that helps. |
Relative paths don't seem to work because Path.join() strips the leading dot. The only way I could get it to work without code changes is to use an absolute path for basePath. |
I think your problem is the base path. It needs to be relative to the current working directory. See the two tests I've added showing relative paths working. |
Well this confused me. But in fact the tests are only passing because the helpers have already been successfully required with the absolute path in previous tests. If you move the new relative path tests so they're the first helper tests, they will fail.
|
Interesting... |
I have server options that include something like:
This works fine for loading the templates but the helpers don't load properly.
My template helpers are in foobar/helpers. In file hapi/lib/views.js Manager.prototype._loadHelpers finds all the helper files properly with paths like foobar/helpers/myhelper.js but then it does a require() on that path which fails to load the file.
Is basePath intended to be a full path?
The text was updated successfully, but these errors were encountered: