{"id":18542,"library":"melodist","title":"Melodist","description":"Melodist is an opinionated bundler for creating TypeScript libraries, version 0.11.1. It uses ESBuild and TypeScript to generate multiple output formats (CJS, ESM, IIFE, React Native) for maximum compatibility. It works in tandem with ESBuild and TypeScript, offering automatic externalization of dependencies, global variable definitions for browser usage, and support for CSS entry points. Release cadence is stable but not documented as frequent.","status":"active","version":"0.11.1","language":"javascript","source_language":"en","source_url":null,"tags":["javascript"],"install":[{"cmd":"npm install melodist","lang":"bash","label":"npm"},{"cmd":"yarn add melodist","lang":"bash","label":"yarn"},{"cmd":"pnpm add melodist","lang":"bash","label":"pnpm"}],"dependencies":[],"imports":[{"note":"Melodist is a CLI tool, not a library. Use npx or npm scripts to run it.","wrong":"import melodist from 'melodist'","symbol":"melodist","correct":"npx melodist [options]"},{"note":"Common mistake: not distinguishing between flag style. Use --format not --format=esm? Actually --format=esm is correct. More common mistake: forgetting --external flags.","wrong":"npx melodist --format esm --minify","symbol":"default (CLI)","correct":"npx melodist --help"},{"note":"If using TypeScript, the config file should be .ts. Melodist reads melodist.config.ts or melodist.config.js.","wrong":"melodist.config.js","symbol":"config file","correct":"melodist.config.ts"}],"quickstart":{"code":"// First install melodist\n// npm install -D melodist\n\n// In package.json, add scripts:\n{\n  \"scripts\": {\n    \"build\": \"melodist --format esm,cjs\",\n    \"prepublishOnly\": \"melodist\"\n  },\n  \"main\": \"./.melodist/cjs/index.js\",\n  \"module\": \"./.melodist/esm/index.js\",\n  \"types\": \"./.melodist/types/index.d.ts\",\n  \"exports\": {\n    \"import\": \"./.melodist/esm/index.mjs\",\n    \"require\": \"./.melodist/cjs/index.js\"\n  }\n}\n\n// Create src/index.ts with your library code\n// Run npm run build to generate bundles in .melodist/","lang":"typescript","description":"Installation, package.json configuration, and basic build command for a TypeScript library."},"warnings":[{"fix":"Add .melodist/ to .gitignore","message":"Melodist outputs to .melodist/ directory by default; ensure .gitignore includes this.","severity":"gotcha","affected_versions":">=0.0.0"},{"fix":"Use --external flags for any devDependencies you want to exclude.","message":"External dependencies: Only dependencies and peerDependencies are external by default; devDependencies are bundled unless explicitly externalized.","severity":"gotcha","affected_versions":">=0.0.0"},{"fix":"Use --format=cjs,esm,iife,rn instead.","message":"The --cjs, --esm, --iife, --rn flags are deprecated in favor of --format.","severity":"deprecated","affected_versions":">=0.8.0"},{"fix":"Set \"exports\": { \"import\": \"./.melodist/esm/index.mjs\" }","message":"If using .mjs output for ESM, ensure your package.json exports field uses .mjs extension.","severity":"gotcha","affected_versions":">=0.0.0"},{"fix":"Either move files to src/ or use --srcdir lib/ flag.","message":"Melodist v0.10.0 changed default srcdir from lib/ to src/.","severity":"breaking","affected_versions":">=0.10.0 <0.11.0? Actually 0.10.0 broke it."},{"fix":"Use a separate CSS build tool if needed.","message":"CSS support is experimental; CSS output may not be minified or optimized.","severity":"gotcha","affected_versions":">=0.0.0"}],"env_vars":null,"last_verified":"2026-04-25T00:00:00.000Z","next_check":"2026-07-24T00:00:00.000Z","problems":[{"fix":"Install as devDependency: npm install -D melodist, then use npx melodist or npm scripts.","cause":"Melodist not installed or not in PATH.","error":"Error: Cannot find module 'melodist'"},{"fix":"Ensure src/index.ts exists or specify entry with --entry flag or meld.config.js.","cause":"Default entry point not found.","error":"Error: No entry point found. Expected src/index.ts or index.ts."},{"fix":"Add --external lodash or ensure lodash is in dependencies in package.json.","cause":"Dependency not externalized correctly.","error":"Module not found: Error: Can't resolve 'lodash'"},{"fix":"Check package.json main vs module fields; use .mjs for ESM exports or set type: module.","cause":"Output file uses ESM imports but runtime expects CommonJS.","error":"Cannot use import statement outside a module"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}