{"id":21246,"library":"esbuild-plugin-handlebars","title":"esbuild-plugin-handlebars","description":"An esbuild plugin that precompiles Handlebars templates during the build process. Current stable version is 1.0.3. It integrates with esbuild's plugin system to handle .hbs files, allowing you to bundle Handlebars templates into your output. Compared to other Handlebars loaders, it is lightweight and focused on esbuild, with options for additional helpers, partials, and precompile options. The package has a simple API and is published on npm with regular maintenance.","status":"active","version":"1.0.3","language":"javascript","source_language":"en","source_url":"https://github.com/inqnuam/esbuild-plugin-handlebars","tags":["javascript","handlebars","esbuild"],"install":[{"cmd":"npm install esbuild-plugin-handlebars","lang":"bash","label":"npm"},{"cmd":"yarn add esbuild-plugin-handlebars","lang":"bash","label":"yarn"},{"cmd":"pnpm add esbuild-plugin-handlebars","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Peer dependency required to use the plugin.","package":"esbuild","optional":false},{"reason":"Required at runtime for template compilation.","package":"handlebars","optional":false}],"imports":[{"note":"This package is ESM-only. Use import syntax or dynamic import().","wrong":"const handlebarsPlugin = require('esbuild-plugin-handlebars')","symbol":"default","correct":"import handlebarsPlugin from 'esbuild-plugin-handlebars'"},{"note":"Named export available as alternative to default import.","wrong":"const { handlebarsPlugin } = require('esbuild-plugin-handlebars')","symbol":"handlebarsPlugin (as named import)","correct":"import { handlebarsPlugin } from 'esbuild-plugin-handlebars'"},{"note":"TypeScript users can import the options type for type safety.","wrong":null,"symbol":"HandlebarsOptions (type)","correct":"import type { HandlebarsOptions } from 'esbuild-plugin-handlebars'"}],"quickstart":{"code":"import esbuild from 'esbuild';\nimport handlebarsPlugin from 'esbuild-plugin-handlebars';\n\nawait esbuild.build({\n  entryPoints: ['src/index.js'],\n  outfile: 'dist/bundle.js',\n  bundle: true,\n  plugins: [handlebarsPlugin({\n    additionalHelpers: {},\n    additionalPartials: {},\n    precompileOptions: {}\n  })],\n});","lang":"javascript","description":"Sets up esbuild with the Handlebars plugin, bundling a JavaScript entry point that imports .hbs templates."},"warnings":[{"fix":"Use dynamic import() or switch to ESM. For Node.js, set \"type\": \"module\" in package.json.","message":"If you use CommonJS require(), the import will fail because the package is ESM-only.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"N/A","message":"No deprecated features at this time.","severity":"deprecated","affected_versions":">=0.0.0"},{"fix":"N/A","message":"No breaking changes in version 1.0.3.","severity":"breaking","affected_versions":">=1.0.0"}],"env_vars":null,"last_verified":"2026-04-27T00:00:00.000Z","next_check":"2026-07-26T00:00:00.000Z","problems":[{"fix":"Run 'npm install esbuild-plugin-handlebars --save-dev' or 'yarn add -D esbuild-plugin-handlebars'.","cause":"Package not installed or not in node_modules.","error":"Error: Cannot find module 'esbuild-plugin-handlebars'"},{"fix":"Use import statement or dynamic import().","cause":"Using CommonJS require() on an ESM-only package.","error":"TypeError: esbuild_plugin_handlebars_1.default is not a function"},{"fix":"Ensure you call the default export as a function: plugins: [handlebarsPlugin()]","cause":"Incorrect usage of the plugin in esbuild config.","error":"Error: The plugin 'esbuild-plugin-handlebars' is not a function or object"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}