Answer the question
In order to leave comments, you need to log in
How to compile pug for client use?
in node.js environment (from pug docs):
//main.js
const pug = require('pug')
console.log(pug.renderFile('template.pug', {
name: 'Timothy'
}));
Uncaught Error: Cannot find module 'fs'
at newRequire (main.js:37)
at localRequire (main.js:53)
at Object.parcelRequire.../node_modules/pug/lib/index.js (main.js:132)
at newRequire (main.js:47)
at localRequire (main.js:53)
at Object.parcelRequire.main.js.pug (main.js:593)
at newRequire (main.js:47)
at main.js:81
at main.js:120
‼ Could not load existing sourcemap of "../node_modules/uglify-js/tools/node.js".
× C:\Users\RokeAlvo\Desktop\js\project\vipeco\frontend\test-pg\node_modules\uglify-js\tools\node.js:169:27: Unterminated string constant (169:27)
167 | }
168 |
> 169 | var mappingUrlPrefix = "\n
| ^
170 | if (options.sourceMapInline) {
171 | stream += mappingUrlPrefix + "data:application/json;charset=utf-8;base64," + new Buffer(source_map).toString("base64");
172 | } else if (options.outSourceMap && typeof options.outSourceMap === "string" && options.sourceMapUrl !== false) {
return `
<div class="item">
<div class="top">
<div class="name">${name}</div>
${ratingBlockTemplate(rating)}
<div class="date">${date}</div>
</div>
${textBlockTemplate(textBlock)}
</div>
`
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question