{"id":20618,"library":"tpl-loader","title":"tpl-loader","description":"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`.","status":"deprecated","version":"0.2.1","language":"javascript","source_language":"en","source_url":"https://github.com/grassator/tpl-loader","tags":["javascript","ejs","underscrore","lodash","_","webpack","loader","template"],"install":[{"cmd":"npm install tpl-loader","lang":"bash","label":"npm"},{"cmd":"yarn add tpl-loader","lang":"bash","label":"yarn"},{"cmd":"pnpm add tpl-loader","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Runtime peer dependency for template compilation function","package":"lodash","optional":false}],"imports":[{"note":"The loader is used via webpack inline syntax. `tpl-loader` can also be used but `tpl!` is the common shorthand.","wrong":"import template from 'tpl-loader!./file.html'","symbol":"tpl","correct":"import template from 'tpl!./file.html'"},{"note":"Configuration is passed through webpack's top-level `tplSettings` property, not imported.","wrong":"// Not a direct import; configurations are set via global webpack config, not imported","symbol":"tplSettings","correct":"// webpack.config.js\nexport const tplSettings = { interpolate: /\\{\\{\\{(.+?)\\}\\}\\}/g }"}],"quickstart":{"code":"// webpack.config.js\n{\n  module: {\n    loaders: [\n      { test: /\\.html$/, loader: 'tpl-loader' }\n    ]\n  },\n  tplSettings: {\n    interpolate: /\\{\\{\\{(.+?)\\}\\}\\}/g\n  }\n}\n\n// In your module:\nimport template from './template.html';\nconst data = { name: 'World' };\nconst result = template(data); // 'Hello {{World}}'","lang":"javascript","description":"Shows how to configure webpack to load .html files as Lodash templates and use the compiled function."},"warnings":[{"fix":"Consider using raw-loader with _.template manually, or switch to a modern template loader like html-loader.","message":"tpl-loader is no longer actively maintained and may not work with webpack 2+ without additional configuration.","severity":"deprecated","affected_versions":">=0.2.0"},{"fix":"Ensure lodash is installed and compatible (v4+ recommended).","message":"Requires lodash as a peer dependency; versions of lodash <4 may have breaking API changes.","severity":"breaking","affected_versions":">=0.1.0"}],"env_vars":null,"last_verified":"2026-04-25T00:00:00.000Z","next_check":"2026-07-24T00:00:00.000Z","problems":[{"fix":"Run `npm install tpl-loader --save-dev`.","cause":"tpl-loader is not installed or not in node_modules.","error":"Module not found: Error: Cannot resolve module 'tpl-loader'"},{"fix":"Install/update lodash: `npm install lodash`.","cause":"lodash is not installed or an older version without _.template support.","error":"TypeError: _.template is not a function"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}