Доброе утро! Подскажите, пожалуйста, имеется index.pug файл с тэгом и переменной name:
ul #{name}
В index.js файле прописано:
import pug from 'pug';
const compiledFunction = pug.compileFile('index.pug');
compiledFunction({ name: 'Hello' });
Хочу, чтобы отправленный в
compiledFunction
аргумент был отрендерен через страницу index.pug.
Но Webpack 5.15 выдает кучу ошибок в терминале наподобие:
ERROR in ./node_modules/jstransformer/index.js 3:9-22
Module not found: Error: Can't resolve 'fs' in '/mnt/c/projectpath/node_modules/jstransformer'
@ ./node_modules/pug-filters/lib/run-filter.js 3:20-44
@ ./node_modules/pug-filters/index.js 3:0-47
@ ./node_modules/pug/lib/index.js 19:14-36
@ ./src/index.js 4:0-22 8:23-38
В консоли браузера:
Uncaught Error: Cannot find module 'path'
Конфигурация Webpack самая обычная:
{
test: /\.pug$/, loader: 'pug-loader', options: { pretty: true },
},
Как исправить проблему?