pugjs / pug

Pug – robust, elegant, feature rich template engine for Node.js
https://pugjs.org
21.7k stars 1.95k forks source link

can't use pug with webpack2 #2856

Closed constantank closed 7 years ago

constantank commented 7 years ago

when i compile ,this came up, Module not found: Error: Can't resolve 'fs' in 'C:\Users\lk\Desktop\wb\node_modules\pug-load',

do you know what's wrong? help me thank you .

constantank commented 7 years ago

this is my js file. const pug = require('pug'); console.log(pug)

ForbesLindesay commented 7 years ago

If you want to use pug with webpack, you need to use https://github.com/pugjs/pug-loader

Using pug dynamically in client side code like you were attempting will be extremely slow (although it can be made to work by configuring webpack to provide empty mocks of node core modules).