npm install pug-html-loader
In your sources:
var html = require('./file.pug')
// => returns file.pug content as html compiled stringIn 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.