{"library":"simple-nunjucks-loader","title":"simple-nunjucks-loader","description":"A Webpack 5 loader that precompiles Nunjucks templates and integrates with html-webpack-plugin. It parses template AST to automatically resolve imports, filters, and extensions, avoiding the default Nunjucks precompilation global. Features a custom {% static %} tag for async asset handling with HMR support. Current stable version is 3.2.0. Maintained by the community with moderate release cadence (major versions for Webpack upgrades). Key differentiators: full compatibility with Webpack 5, dynamic asset resolution, and zero global pollution.","language":"javascript","status":"active","last_verified":"Sat Apr 25","install":{"commands":["npm install simple-nunjucks-loader"],"cli":null},"imports":["Use in webpack rules: { test: /\\.njk$/, use: ['simple-nunjucks-loader'] }","import tmpl from './template.njk'; tmpl({ foo: 'bar' })","// No built-in types; define custom .d.ts: declare module '*.njk' { const tmpl: (ctx: Record<string, any>) => string | Promise<string>; export default tmpl; }"],"auth":{"required":false,"env_vars":[]},"quickstart":{"code":"// webpack.config.js\nconst HtmlWebpackPlugin = require('html-webpack-plugin');\n\nmodule.exports = {\n  module: {\n    rules: [\n      {\n        test: /\\.njk$/,\n        use: ['simple-nunjucks-loader']\n      }\n    ]\n  },\n  plugins: [\n    new HtmlWebpackPlugin({\n      template: './src/index.njk',\n      filename: 'index.html'\n    })\n  ]\n};\n\n// src/index.njk\n<!DOCTYPE html>\n<html>\n<head><title>{{ title }}</title></head>\n<body>\n<h1>Hello, {{ name }}!</h1>\n</body>\n</html>\n\n// src/index.js\nimport './index.njk'; // Used via HtmlWebpackPlugin, not needed in JS\nconsole.log('Template loaded');","lang":"javascript","description":"Shows basic Webpack setup with simple-nunjucks-loader and html-webpack-plugin.","tag":null,"tag_description":null,"last_tested":null,"results":[]},"compatibility":null}