Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
muslnode 18–226 runs
build_error
glibcnode 18–226 runs
build_error
Code
Verified usage
Verified import paths — ran on the pinned version, not inferred.
default
✓ import template from 'jade!./file.jade';
✗ require('jade-loader!./file.jade')
Use the 'jade!' prefix in require/import to run the loader. ESM or CJS both work with the same syntax.
jade
✓ const jade = require('jade');
✗ const jade = require('jade-loader');
jade-loader is a webpack loader, not a runtime module. The jade package itself is the runtime dependency.
webpack config
✓ module.exports = { module: { rules: [ { test: /\.jade$/, use: 'jade-loader' } ] } };
✗ module.exports = { module: { loaders: [ { test: /\.jade$/, loader: 'jade' } ] } };
In webpack 2+, use rules with 'use' property. The 'jade' loader must be spelled 'jade-loader'.
Shows how to configure and use jade-loader in a webpack project to import .jade templates as template functions.
// Install
// npm install jade-loader jade webpack --save-dev
// webpack.config.js
module.exports = {
module: {
rules: [
{
test: /\.jade$/,
use: 'jade-loader'
}
]
}
};
// app.js
const template = require('./file.jade');
const html = template({ name: 'World' });
document.body.innerHTML = html;
// file.jade
h1 Hello, #{name}!
Errors
Common errors & fixes
ERROR in ./file.jade
Module parse failed: Unexpected token (1:0)
You may need an appropriate loader to handle this file type.
Missing or misconfigured jade-loader in webpack config.
fixAdd a rule to module.rules: { test: /\.jade$/, use: 'jade-loader' } Cannot find module 'jade'
jade peer dependency not installed.
fixRun: npm install jade --save-dev (or --save)
require is not defined
Using jade-loader in a non-module environment (e.g., directly in browser without webpack).
fixEnsure the template is bundled with webpack, or use the jade runtime directly.
Audit
Dependencies
jaderequiredcompiles .jade templates into template functions
webpackrequiredwebpack is the runtime environment for loaders