Registry /
devops / lodash-template-webpack-loader
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.
lodash-template-webpack
✓ module.exports = { module: { loaders: [{ test: /\.tpl$/, loader: 'lodash-template-webpack' }] } }
✗ import lodashTemplateWebpack from 'lodash-template-webpack'
This is a webpack loader, not a JS module. It is referenced by the string 'lodash-template-webpack' in webpack config loaders array.
Shows webpack config, template imports module, and usage in a JS file with Lodash template syntax.
// webpack.config.js
const path = require('path');
module.exports = {
entry: './src/index.js',
output: { filename: 'bundle.js', path: path.resolve(__dirname, 'dist') },
module: {
loaders: [
{ test: /\.tpl$/, loader: 'lodash-template-webpack' }
]
},
lodashTemplateLoader: {
engine: 'lodash',
importsModule: path.join(__dirname, 'template-imports')
}
};
// template-imports.js
module.exports = {
scream: function(str) { return (str || '').toUpperCase(); }
};
// src/index.js
var template = require('./template.tpl');
document.body.innerHTML = template({ title: 'Hello' });
// template.tpl
<h1><%= title %></h1>
<p><%- scream('hello') %></p>
Errors
Common errors & fixes
Module build failed: Error: Cannot find module 'lodash'
Lodash not installed or not in node_modules; loader requires lodash unless globalLodash is set.
fixnpm install lodash --save-dev OR set globalLodash: true in loader options.
DeprecationWarning: loaderUtils.parseQuery is deprecated
Using webpack version that deprecated parseQuery; the loader uses old API.
fixUse webpack 1, or patch loader source; consider alternative.
Error: Cannot find module './path/to/template.tpl'
Webpack rule not matching .tpl files or loader not configured correctly.
fixEnsure test regex matches file extension and loader name is correct.
Audit
Dependencies
lodashoptionalUsed as default template engine (unless overridden by 'engine' or 'globalLodash')
webpackrequiredPeer dependency – loader requires webpack to function