fix(ENG-10904): export proper component#12
Conversation
There was a problem hiding this comment.
Pull Request Overview
This PR restructures the build output and export configuration to properly export the React component bundle. The changes simplify the distribution structure by moving from nested directories to a flat structure and updating package.json to properly expose the built components.
Key changes:
- Consolidates build outputs from nested directories (
dist/react/*,dist/webcomponent/*) to flat structure (dist/index.*,dist/webcomponent.js) - Updates package.json with proper export maps and entry points for both React component and web component usage
- Enhances build configuration with better TypeScript and PostCSS settings
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| rollup.config.mjs | Restructures build configuration to output files in flat directory structure and improves plugin configurations |
| package.json | Adds proper export maps, entry points, and files specification for npm package distribution |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
| format: "cjs", | ||
| }, | ||
| ], | ||
| external: ["react", "react-dom", "react-hook-form"], |
There was a problem hiding this comment.
[nitpick] The external dependencies array should be moved to a shared constant or configuration object to avoid duplication if other bundles need the same externals. This improves maintainability when dependencies change.
| del({ targets: "dist/react/*" }), | ||
| external(), | ||
| resolve(), | ||
| del({ targets: "dist/*" }), |
There was a problem hiding this comment.
Using a wildcard deletion dist/* in the first bundle configuration will clean the entire dist directory, potentially removing files that other bundles in the same build process might need. Consider using more specific targets or coordinating the cleanup across all bundle configurations.
| del({ targets: "dist/*" }), | |
| del({ targets: "dist/*", runOnce: true }), |
Summary by cubic
Fix package exports and build outputs so @stackone/hub exposes the correct React component and web component. Unblocks ENG-10904 by making the new Hub importable in the dashboard and sandbox behind the org feature flag.
Bug Fixes
Migration