Registry / web-framework / tpl-loader

tpl-loader

JSON →
library0.2.1jsnpmunverified

A webpack loader that compiles Underscore/Lodash templates using `_.template` to return a reusable template function. Version 0.2.1 is the latest stable release. It has no active maintenance and is largely superseded by modern webpack and built-in template handling. Key differentiator: simple replacement for the deprecated `underscore-loader`.

npm install tpl-loader
INSTALL
IMPORT
SIG · TPL-LOADER
T
tpl-loader
web-frameworkjavascriptv0.2.1
Install
Import
Disk
Pass rate
0/ 6
Env Coverage0 / 6
glibc
1822
musl
1822
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
musl
node 18226 runs
build_error
glibc
node 18226 runs
build_error
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

tpl
import template from 'tpl!./file.html'
import template from 'tpl-loader!./file.html'
The loader is used via webpack inline syntax. `tpl-loader` can also be used but `tpl!` is the common shorthand.
tplSettings
// webpack.config.js export const tplSettings = { interpolate: /\{\{\{(.+?)\}\}\}/g }
// Not a direct import; configurations are set via global webpack config, not imported
Configuration is passed through webpack's top-level `tplSettings` property, not imported.

Shows how to configure webpack to load .html files as Lodash templates and use the compiled function.

// webpack.config.js { module: { loaders: [ { test: /\.html$/, loader: 'tpl-loader' } ] }, tplSettings: { interpolate: /\{\{\{(.+?)\}\}\}/g } } // In your module: import template from './template.html'; const data = { name: 'World' }; const result = template(data); // 'Hello {{World}}'
Debug
Known issues
deprecatedtpl-loader is no longer actively maintained and may not work with webpack 2+ without additional configuration.
fix
Consider using raw-loader with _.template manually, or switch to a modern template loader like html-loader.
affects: >=0.2.0
breakingRequires lodash as a peer dependency; versions of lodash <4 may have breaking API changes.
fix
Ensure lodash is installed and compatible (v4+ recommended).
affects: >=0.1.0
Errors
Common errors & fixes
Module not found: Error: Cannot resolve module 'tpl-loader'
tpl-loader is not installed or not in node_modules.
fix
Run `npm install tpl-loader --save-dev`.
TypeError: _.template is not a function
lodash is not installed or an older version without _.template support.
fix
Install/update lodash: `npm install lodash`.
Upgrade
Version history
0.2.1latest on npm
Audit
Dependencies
lodashrequiredRuntime peer dependency for template compilation function
Agent activity
7 hits · last 30 days
node
6
OpenAI (training)
1
Resources
tpl-loader — npm install tpl-loader · libregistry