{"id":25388,"library":"esbuild-plugin-prismjs","title":"esbuild-plugin-prismjs","description":"An esbuild plugin for PrismJS that bundles specified languages, plugins, and themes at build time. Current stable version is 1.0.8, updated infrequently. It mirrors the options of babel-plugin-prismjs, allowing developers familiar with that plugin to switch seamlessly. Offers an inline option to embed CSS directly. Designed for projects using esbuild and needing syntax highlighting via PrismJS without runtime loading of languages.","status":"active","version":"1.0.8","language":"javascript","source_language":"en","source_url":"https://github.com/activeguild/esbuild-plugin-prismjs","tags":["javascript","esbuild","prism","prismjs","plugin","typescript"],"install":[{"cmd":"npm install esbuild-plugin-prismjs","lang":"bash","label":"npm"},{"cmd":"yarn add esbuild-plugin-prismjs","lang":"bash","label":"yarn"},{"cmd":"pnpm add esbuild-plugin-prismjs","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Required as a peer dependency to provide the PrismJS library","package":"prismjs","optional":false}],"imports":[{"note":"ESM-only; does not support CommonJS require.","wrong":"const prismjsPlugin = require('esbuild-plugin-prismjs')","symbol":"prismjsPlugin","correct":"import { prismjsPlugin } from 'esbuild-plugin-prismjs'"},{"note":"This is a TypeScript type, not a runtime value.","wrong":"import { PrismjsPluginOptions } from 'esbuild-plugin-prismjs'","symbol":"PrismjsPluginOptions","correct":"import type { PrismjsPluginOptions } from 'esbuild-plugin-prismjs'"},{"note":"Default export is also available (same as named export).","wrong":"","symbol":"default","correct":"import prismjsPlugin from 'esbuild-plugin-prismjs'"}],"quickstart":{"code":"import { prismjsPlugin } from 'esbuild-plugin-prismjs';\nimport { build } from 'esbuild';\n\nbuild({\n  entryPoints: ['./src/index.js'],\n  outdir: 'dist',\n  bundle: true,\n  plugins: [\n    prismjsPlugin({\n      inline: true,\n      languages: ['javascript', 'css'],\n      plugins: ['line-numbers'],\n      theme: 'okaidia',\n      css: true,\n    }),\n  ],\n}).catch(() => process.exit(1));","lang":"typescript","description":"Configures esbuild with prismjsPlugin to bundle JavaScript and CSS highlighting, with line-numbers plugin and okaidia theme."},"warnings":[{"fix":"Use ES import syntax (import { prismjsPlugin } from 'esbuild-plugin-prismjs').","message":"Only supports ESM imports, CommonJS require will throw an error.","severity":"breaking","affected_versions":">=1.0.0"},{"fix":"Set inline: false in the plugin options to get separate CSS output.","message":"The 'inline' option defaults to true, embedding CSS. If you want separate CSS files, set it to false.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Ensure css: true (or omit) to include theme CSS.","message":"The 'css' option must be true if you want the theme CSS to be included. It defaults to true but can be disabled.","severity":"gotcha","affected_versions":">=1.0.0"}],"env_vars":null,"last_verified":"2026-05-01T00:00:00.000Z","next_check":"2026-07-30T00:00:00.000Z","problems":[{"fix":"Change to ES import: import { prismjsPlugin } from 'esbuild-plugin-prismjs'","cause":"Incorrect import using CommonJS require()","error":"TypeError: prismjsPlugin is not a function"},{"fix":"Run: npm install prismjs","cause":"PrismJS is not installed as a dependency","error":"Error: Cannot find module 'prismjs'"},{"fix":"Check the language list: https://prismjs.com/#languages-list","cause":"An unsupported or misspelled language name was provided in the options","error":"Error: Unknown language 'xyz'"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}