Registry / devops / esbuild-plugin-templatejs

esbuild-plugin-templatejs

JSON →
library3.1.4jsnpmunverified

An esbuild plugin for compiling template.js templates during bundling. Current stable version is 3.1.4. It integrates template.js with esbuild, allowing you to import .tmpl files and compile them into render functions. Requires @templatejs/runtime as a peer dependency. The plugin supports configurable delimiters and expression for accessing the runtime. It is part of the template.js ecosystem, providing a fast build step for template compilation compared to runtime-only approaches.

npm install esbuild-plugin-templatejs
INSTALL
IMPORT
SIG · ESBUILD-PLUGIN-TEM
E
esbuild-plugin-templatejs
devopsjavascriptv3.1.4
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

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

default
import templatejs from 'esbuild-plugin-templatejs'
const templatejs = require('esbuild-plugin-templatejs')
The package is ESM-only since v3. Use named or default import.
Plugin
import type { Plugin } from 'esbuild'
import { Plugin } from 'esbuild-plugin-templatejs'
The plugin type is from esbuild, not from this package.
templatejs
import templatejs from 'esbuild-plugin-templatejs'
import { templatejs } from 'esbuild-plugin-templatejs'
The default export is the plugin factory; named exports are not available.

Configures esbuild with templatejs plugin to compile .tmpl files during bundle.

import * as esbuild from 'esbuild'; import templatejs from 'esbuild-plugin-templatejs'; await esbuild.build({ entryPoints: ['./src/app.js'], bundle: true, outfile: './dist/index.js', plugins: [ templatejs({ sTag: '<%', eTag: '%>', expression: 'require("@templatejs/runtime")', }), ], });
Debug
Known issues
deprecatedThe default export may change in future versions.
fix
Use named export if available, or check changelog.
affects: >=3.0.0
gotchaMust install @templatejs/runtime separately.
fix
Run npm install @templatejs/runtime
affects: >=3.0.0
gotchaThe plugin is ESM-only; using require() will fail.
fix
Use import syntax and ensure your project is configured for ESM.
affects: >=3.0.0
Errors
Common errors & fixes
Error: Cannot find module '@templatejs/runtime'
@templatejs/runtime is not installed.
fix
npm install @templatejs/runtime
TypeError: templatejs is not a function
Importing the plugin incorrectly, e.g., using named import instead of default.
fix
Use import templatejs from 'esbuild-plugin-templatejs'
Upgrade
Version history
3.1.4latest on npm
Audit
Dependencies
@templatejs/runtimerequiredPeer dependency; provides the runtime for executing compiled templates.
Agent activity
2 hits · last 30 days
node
2
Resources
esbuild-plugin-templatejs — npm install esbuild-plugin-templatejs · libregistry