-
Notifications
You must be signed in to change notification settings - Fork 6
Open
Open
Copy link
Labels
enhancementNew feature or requestNew feature or request
Description
🔹 Overview
The ui-toolkit project is currently using Webpack but is not configured to output ESM (ECMAScript Modules). This can lead to optimization bailouts in modern frameworks like Angular and React.
To modernize the build system, improve tree-shaking, and enhance performance, we need to:
- Add ESM support to
ui-toolkitby configuring Webpack (or considering alternatives like Vite or Rollup). - Update
ui-toolkit-angularandui-toolkit-reactto ensure compatibility with the new ESM output.
This will ensure that all three repositories are ESM-compatible and optimized for modern JavaScript bundlers.
🎯 Task Scope
1️⃣ Update ui-toolkit to Support ESM Output
- Step 1: Update Webpack configuration to support ESM output:
- Set
output.moduletotrue. - Use
type: 'module'inpackage.json. - Ensure correct
exportsfield for both CJS and ESM:"exports": { ".": { "import": "./dist/esm/index.js", "require": "./dist/cjs/index.js" } }
- Set
- Step 2: Ensure tree-shaking is enabled for ESM builds.
- Step 3: Update TypeScript configuration (
tsconfig.json) to:- Use
"module": "ESNext". - Ensure type declarations are compatible with ESM.
- Use
- Step 4: Test and validate the ESM build output:
- Confirm no optimization bailouts in Angular and React projects.
2️⃣ Update ui-toolkit-angular for ESM Compatibility
- Step 1: Update imports to support ESM:
import { SomeComponent } from '@device-management-toolkit/ui-toolkit'
- Step 2: Test the updated package with:
- Angular 19 (ensure compatibility with Ivy and ESM)
- Step 3: Verify no console warnings or errors related to ESM.
3️⃣ Update ui-toolkit-react for ESM Compatibility
- Step 1: Update imports to use ESM syntax.
- Step 2: Test with React 19+.
- Step 3: Verify compatibility with React's native tree-shaking.
4️⃣ Ensure Compatibility and Test Across Projects
- Ensure no breaking changes in:
ui-toolkitui-toolkit-angularui-toolkit-react
- Test integration in real-world projects to validate ESM support:
- Confirm no optimization bailouts in Angular and React builds.
- Ensure tree-shaking works effectively.
📂 Relevant Repositories
💻 Technical Details
- Webpack Configuration Changes:
- Use
"type": "module"inpackage.json. - Set output to:
output: { filename: '[name].js', module: true, library: { type: 'module' } }
- Ensure compatibility with both CommonJS (CJS) and ESM.
- Use
- Alternative Build Tools:
- Consider using Rollup or Vite if Webpack config becomes too complex.
- TypeScript Adjustments:
- Update
tsconfig.jsonto use:"module": "ESNext", "target": "ES2022"
- Update
- Testing Compatibility:
- Test with:
- Angular 19 and React 19+.
- Next.js or Vite for ESM compatibility validation.
- Test with:
✅ Acceptance Criteria
-
ui-toolkitoutputs ESM-compatible bundles. - No optimization bailouts in Angular or React. This warning should not exist when running
npm run build-enterprise:
-
ui-toolkit-angularis fully compatible with the new ESM output. -
ui-toolkit-reactis fully compatible with the new ESM output. - All three repositories are tested for tree-shaking and performance improvements.
- A Pull Request (PR) is submitted for each repository with a summary of changes.
🚀 How to Get Started
- Comment below to claim this issue.
- Fork the repos and create branches (e.g.,
feature/esm-support). - Implement ESM support and update wrappers accordingly.
- Submit Pull Requests (PRs) linking this issue.
📎 Additional Notes
- Backward compatibility with CJS should be maintained where possible.
- If you encounter issues with Angular or React compatibility, document them in the PR.
- Consider using module resolution strategies for smooth integration.
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or request
Type
Projects
Status
Future Items
