Description
I'm getting a runtime error running precompile.js
on line 114.
Command line:
$ node_modules/nunjucks/bin/precompile input_template.xml > output_template.js
gives a TypeError in the function _precompile
when it tries to call:
name = name.replace(/\\/g, '/');
Debugging, this is because further up the stack, in the precompile
function, line 85, the call to _precompile
passes in as the second argument opts.name || input
. Whilst input
is indeed my input filename string, opts.name
is a function pointer, not a string. Replacing this text with opts.name() || input
appears to fix the problem, though I'm not familiar enough with the codebase to understand if that is the right place to make the fix.
In my case opts.name()
returns undefined
, which means the input filename gets used instead.
nunjucks release 3.2.1
node v12.7.0
Stack trace:
name = name.replace(/\\/g, '/');
^
TypeError: name.replace is not a function
at _precompile (/XXX/node_modules/nunjucks/src/precompile.js:114:15)
at precompile (/XXX/node_modules/nunjucks/src/precompile.js:85:22)
at Object.<anonymous> (/XXX/node_modules/nunjucks/bin/precompile:45:13)
at Module._compile (internal/modules/cjs/loader.js:777:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:788:10)
at Module.load (internal/modules/cjs/loader.js:643:32)
at Function.Module._load (internal/modules/cjs/loader.js:556:12)
at Function.Module.runMain (internal/modules/cjs/loader.js:840:10)
at internal/main/run_main_module.js:17:11
Metadata
Assignees
Labels
No labels