{"id":18195,"library":"castle-email-lib","title":"Castle Email Library","description":"A library for building emails with React, version 2.5.0. Provides components and utilities to create responsive, template-based emails using React, simplifying the process of generating HTML emails. It emphasizes a component-based approach, allowing reuse and composition, and integrates with common email sending services. Key differentiators include a focus on React developers familiar with JSX, reducing the need for traditional email template languages. Currently stable with regular updates.","status":"active","version":"2.5.0","language":"javascript","source_language":"en","source_url":null,"tags":["javascript"],"install":[{"cmd":"npm install castle-email-lib","lang":"bash","label":"npm"},{"cmd":"yarn add castle-email-lib","lang":"bash","label":"yarn"},{"cmd":"pnpm add castle-email-lib","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"peer dependency for rendering components","package":"react","optional":false}],"imports":[{"note":"ESM only; CJS not supported","wrong":"const { CastleEmail } = require('castle-email-lib')","symbol":"CastleEmail","correct":"import { CastleEmail } from 'castle-email-lib'"},{"note":"Export from subpath; default export is not available.","wrong":"import EmailRenderer from 'castle-email-lib'","symbol":"EmailRenderer","correct":"import { EmailRenderer } from 'castle-email-lib/renderer'"},{"note":"Named export only.","wrong":"import Template from 'castle-email-lib/templates'","symbol":"Template","correct":"import { Template } from 'castle-email-lib/templates'"}],"quickstart":{"code":"import { CastleEmail, EmailRenderer } from 'castle-email-lib';\nimport React from 'react';\n\nconst MyEmail = () => (\n  <CastleEmail>\n    <h1>Hello World</h1>\n  </CastleEmail>\n);\n\nconst renderer = new EmailRenderer();\nconst html = renderer.render(<MyEmail />);\nconsole.log(html);","lang":"typescript","description":"Shows basic usage of CastleEmail component and EmailRenderer to generate email HTML."},"warnings":[{"fix":"Update imports: `import { CastleEmail } from 'castle-email-lib'` and subpath imports for additional exports.","message":"Version 2.0.0 changed the import paths from root to subpaths.","severity":"breaking","affected_versions":">=2.0.0"},{"fix":"Use named imports instead.","message":"The default export was removed in v2.0.0.","severity":"deprecated","affected_versions":">=2.0.0"},{"fix":"Always pass a React element, e.g., `renderer.render(<MyComponent />)`.","message":"EmailRenderer expects JSX element, not component class or string.","severity":"gotcha","affected_versions":"all"},{"fix":"Use ESM imports or upgrade build system.","message":"CJS support dropped in v2.0.0, only ESM is supported.","severity":"breaking","affected_versions":">=2.0.0"}],"env_vars":null,"last_verified":"2026-04-25T00:00:00.000Z","next_check":"2026-07-24T00:00:00.000Z","problems":[{"fix":"Run `npm install castle-email-lib` and use correct import: `import { CastleEmail } from 'castle-email-lib'`.","cause":"Missing package install or incorrect import path.","error":"Module not found: Can't resolve 'castle-email-lib'"},{"fix":"Use named import: `import { CastleEmail } from 'castle-email-lib'`.","cause":"Using default import for non-default export.","error":"Uncaught TypeError: castle_email_lib_1.CastleEmail is not a constructor"},{"fix":"Ensure React is installed and import CastleEmail correctly.","cause":"Undefined symbol in scope, likely due to import error or missing peer dependency.","error":"CastleEmail is not defined"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}