Skip to content

Commit

Permalink
Fix hot reload and use require hook for compiled server templates if …
Browse files Browse the repository at this point in the history
…available (#1310)
  • Loading branch information
DylanPiercey authored and mlrawlings committed Apr 4, 2019
1 parent 3c764ea commit c44aa04
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
4 changes: 4 additions & 0 deletions src/hot-reload.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,10 @@ function tryReloadTemplate(path) {
path = path.replace(/\.js$/, "");

try {
if (require.extensions[".marko"]) {
return require(path);
}

return marko.load(path);
} catch (e) {
return undefined;
Expand Down
12 changes: 5 additions & 7 deletions src/node-require/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -92,13 +92,11 @@ function install(options) {
? options.require.extensions
: require.extensions;

var compilerOptions = options.compilerOptions;

if (compilerOptions) {
require("../compiler").configure(compilerOptions);
} else {
compilerOptions = {};
}
var compilerOptions = Object.assign(
{ requireTemplates: true },
options.compilerOptions
);
require("../compiler").configure(compilerOptions);

var extensions = [];

Expand Down

0 comments on commit c44aa04

Please sign in to comment.