{"id":25359,"library":"esbuild-plugin-json-cleaner","title":"esbuild-plugin-json-cleaner","description":"An esbuild plugin for cleaning JSON files during the build process. It supports removing top-level tags (like schema references), minifying output, and customizing indentation. Current version is 0.1.3, released as an early-stage tool with peer dependency on esbuild ^0.27.2. It differentiates by being a minimal, focused plugin for JSON cleanup in esbuild builds, with TypeScript support and dual ESM/CJS exports. Suitable for workflows that need to strip metadata from JSON files before bundling.","status":"active","version":"0.1.3","language":"javascript","source_language":"en","source_url":"https://github.com/AFCMS/esbuild-plugin-json-cleaner","tags":["javascript","esbuild","json","plugin","typescript"],"install":[{"cmd":"npm install esbuild-plugin-json-cleaner","lang":"bash","label":"npm"},{"cmd":"yarn add esbuild-plugin-json-cleaner","lang":"bash","label":"yarn"},{"cmd":"pnpm add esbuild-plugin-json-cleaner","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"peer dependency required for plugin to function","package":"esbuild","optional":false}],"imports":[{"note":"Default export only; CommonJS require results in undefined.","wrong":"const JSONCleanerPlugin = require('esbuild-plugin-json-cleaner')","symbol":"default","correct":"import JSONCleanerPlugin from 'esbuild-plugin-json-cleaner'"}],"quickstart":{"code":"import esbuild from 'esbuild';\nimport JSONCleanerPlugin from 'esbuild-plugin-json-cleaner';\n\nawait esbuild.build({\n  outdir: 'dist',\n  plugins: [\n    JSONCleanerPlugin({\n      src: 'src/data.json',\n      out: 'data.json',\n      removeSchema: true,\n      removeTags: ['project', 'revision'],\n      minify: false,\n      space: 2,\n    }),\n  ],\n});","lang":"typescript","description":"Shows how to configure the plugin to remove 'schema' and specific tags from a JSON file, with custom indentation."},"warnings":[{"fix":"Use import syntax or use the default export via require('esbuild-plugin-json-cleaner').default.","message":"Default export only; CommonJS require returns undefined.","severity":"gotcha","affected_versions":">=0.1.0"},{"fix":"Update esbuild to version ^0.27.2 or later.","message":"Peer dependency esbuild ^0.27.2 required; older versions incompatible.","severity":"breaking","affected_versions":">=0.1.0"},{"fix":"Use Node.js version 24 or higher.","message":"Node.js >=24 required; fails on older versions.","severity":"gotcha","affected_versions":">=0.1.0"},{"fix":"Use multiple plugin instances for multiple files or manually iterate.","message":"Plugin processes only the specified src file; no glob or directory support.","severity":"gotcha","affected_versions":">=0.1.0"},{"fix":"Specify full top-level keys to remove.","message":"removeTags removes top-level keys only; nested keys are unaffected.","severity":"gotcha","affected_versions":">=0.1.0"}],"env_vars":null,"last_verified":"2026-05-01T00:00:00.000Z","next_check":"2026-07-30T00:00:00.000Z","problems":[{"fix":"Use import JSONCleanerPlugin from 'esbuild-plugin-json-cleaner' or const JSONCleanerPlugin = require('esbuild-plugin-json-cleaner').default","cause":"Using CommonJS require and calling it as a function, but default export requires import or .default","error":"TypeError: JSONCleanerPlugin is not a function"},{"fix":"Run npm install esbuild --save-dev","cause":"esbuild is not installed as a dev dependency","error":"Error: Build failed with 1 error: error: [plugin: JSONCleaner] Cannot find module 'esbuild'"},{"fix":"Check that src path is relative to the project root and file exists","cause":"Source file path is incorrect or file does not exist","error":"error: [plugin: JSONCleaner] Failed to read file: src/data.json"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}