Closed danielbayerlein closed 8 years ago
I'm able to get my code working with:
engines: {
js: HapiReactViews,
}
However, you have to restart the server after every change since only .jsx
files currently benefit from the removeCache
option. (I submitted #60 to hopefully resolve this.)
Thanks for opening an issue @danielbayerlein. @tribou's answer should work. Please give it a shot and let us know.
@tribou @jedireza
Thanks for the response.
In production the server will recognize the .js
ending - in development the .jsx
. So I think we need a different configuration for production and development, or?
I'd reach for confidence
in this case. confidence
allows you to change your configuration based on a criteria (in your case NODE_ENV
).
@jedireza Thank you!
@danielbayerlein Sorry to bother you in this issue but I'm experiencing the same issue here and when I add js: HapiReactViews
in my engines configuration object I got an error:
Unknown extension and no defaultExtension configured for view template: Default
( my original file is name Default.jsx ).
In my view route I just put reply.view('Default')
so do I have to write an extension? If so, how did you deal with it? Using a env argument? Thanks
Update: solved it with the defaultExtension
option on the server.views
@ThiagoMiranda Nice to hear that it works. 👍
I use Babel CLI for production to compile my ES6 code to ES5. The files with the extension
.jsx
be compiled to.js
. The server will only recognize the.jsx
ending. How do you solve the problem?