Skip to content

fix(ENG-10904): export proper component#12

Merged
adefreitas merged 1 commit into
mainfrom
fix-build
Aug 28, 2025
Merged

fix(ENG-10904): export proper component#12
adefreitas merged 1 commit into
mainfrom
fix-build

Conversation

@adefreitas

@adefreitas adefreitas commented Aug 28, 2025

Copy link
Copy Markdown
Collaborator

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

    • Point package entry to dist (main/module/types) with an exports map, and publish only dist.
    • Consolidate build artifacts to dist/index.esm.js, dist/index.js, dist/index.d.ts, and dist/webcomponent.js.
    • Mark React libs as external and inline CSS via PostCSS for consistent runtime behavior.
  • Migration

    • Import React usage from the package root: import { StackOneHub } from "@stackone/hub".
    • For the web component, use: import "@stackone/hub/webcomponent" (stop importing from dist/react or dist/webcomponent paths).

Copilot AI review requested due to automatic review settings August 28, 2025 15:35

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread rollup.config.mjs
format: "cjs",
},
],
external: ["react", "react-dom", "react-hook-form"],

Copilot AI Aug 28, 2025

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[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.

Copilot uses AI. Check for mistakes.
Comment thread rollup.config.mjs
del({ targets: "dist/react/*" }),
external(),
resolve(),
del({ targets: "dist/*" }),

Copilot AI Aug 28, 2025

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Suggested change
del({ targets: "dist/*" }),
del({ targets: "dist/*", runOnce: true }),

Copilot uses AI. Check for mistakes.
@adefreitas adefreitas merged commit 5b2803c into main Aug 28, 2025
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants