npm package: @radaid/radreport-template-builder
Description: A template and report builder for radiology reports
Latest version: 2.0.7-beta.15

# 📝 RadReport Template Editor

The **RadReport Template Editor** is a robust toolkit for creating and managing **medical radiology templates** using HTML. It supports structured reporting and enables dynamic templates creation, all while aligning with standardized medical reporting practices.

---

## ✨ Features

- ✅ Create or import **radiology report templates** using HTML.
- 🧱 Dynamically add, remove, and edit **sections** and **fields**.
- 📥 Import existing standard templates.
- 💡 Built with flexibility to support standard reporting workflows.

---

## 🚀 Getting Started

### 📦 Build the Package

To build the package for production:

```bash
yarn run build
```
---

### 📦 Usage in Other Projects

When importing \`@radaid/radreport-template-builder\` into another project, make sure to configure **React**, **ReactDOM**, and **JSX Runtime** aliases properly to avoid issues like duplicate React instances or unresolved modules. These issues commonly occur in monorepos, local linking setups (e.g., \`pnpm link\`), or even in production builds where the package is consumed as a UMD bundle.

---

#### 🔧 Webpack Configuration

If your project uses **Webpack**, update your config like this:

```js
resolve: {
  alias: {
    react: path.resolve(__dirname, '../../../node_modules/react'),
    'react-dom': path.resolve(__dirname, '../../../node_modules/react-dom'),
    'react/jsx-runtime': path.resolve(__dirname, '../../../node_modules/react/jsx-runtime'),
    React: path.resolve(__dirname, '../../../node_modules/react'),
    ReactDOM: path.resolve(__dirname, '../../../node_modules/react-dom'),
    ReactJSXRuntime: path.resolve(__dirname, '../../../node_modules/react/jsx-runtime'),
  },
  modules: [
    'node_modules',
    path.resolve(__dirname, 'src'),
  ],
},
```

---

#### 🔧 Next.js Configuration

If your project uses **Next.js**, modify your \`next.config.js\` as follows:

```js
// next.config.js
webpack: (config) => {
  config.resolve.alias = {
    ...config.resolve.alias,
    React: require.resolve('react'),
    ReactDOM: require.resolve('react-dom'),
    ReactJSXRuntime: require.resolve('react/jsx-runtime'),
  };
  return config;
};
```

# Version Information and Fixes

## v2.0.7-beta.11

- Fixed **appconfig** passing issue in `TemplateService`.  
- Now considers values configured dynamically that passing on package initalization time.  

---

> ℹ️ **Note:** This setup is especially important when:
> 
> - Using \`@radaid/radreport-template-builder\` via local linking (\`pnpm link\`)
> - Installing the package via registry (e.g., \`pnpm add\`) and encountering build errors like:
>
> ```
> Module not found: Can't resolve 'React'
> Module not found: Can't resolve 'ReactDOM'
> Module not found: Can't resolve 'ReactJSXRuntime'
>```
>
> These errors usually occur during **Next.js production builds** (\`next build\`) or in CI/CD pipelines when UMD builds are consumed.
>
> To resolve this, ensure that the consuming app explicitly resolves these dependencies using aliasing (as shown above) and that the required versions of \`react\`, \`react-dom\`, and \`react/jsx-runtime\` are installed at the root level of your project.