npm install pug-html-loader
In your sources:
var json = require('./file.pug')
// => returns file.pug content as html compiled string
In your webpack.config.js file:
module.exports = {
// your config settings ...
module: [
//your modules...
loaders: [{
include: /\.pug/,
loader: 'pug-html-loader'
}]
]
};
Don't forget to polyfill require
if you want to use it in node.
See webpack
documentation.