When including a .pug file as a template in HtmlWebpackPlugin:
plugins: [
new HtmlWebpackPlugin({
template: '!!pug!./app/index.pug'
})
]
//- index.pug
doctype html
html
head
title Page Title
body
h1 Pug Template
include partial.pug
//- partial.pug
h2 This was included from partial.pug
Executing webpack-dev-server throws
ERROR in ./app/partial.pug
Module parse failed: /path/to/pug-loader--bug/app/partial.pug Unexpected token (1:3)
You may need an appropriate loader to handle this file type.
SyntaxError: Unexpected token (1:3)
When including a .pug file as a template in HtmlWebpackPlugin:
Executing webpack-dev-server throws
But if I either add a mixin to partial.pug:
Or add a loader to webpack.config.js:
everything works.
Simply requiring index.pug in a javascript file works properly, mixin or no mixin. To summarize:
How can mere presence of a mixin make or break include? I have no idea. Test repo