Skip to content

Add style export condition for stylesheet - #54

Open
esezen wants to merge 1 commit into
mainfrom
cdx-514-fix-pia-stylesheet-import-failure-in-nextturbopack
Open

Add style export condition for stylesheet#54
esezen wants to merge 1 commit into
mainfrom
cdx-514-fix-pia-stylesheet-import-failure-in-nextturbopack

Conversation

@esezen

@esezen esezen commented Aug 11, 2026

Copy link
Copy Markdown
Contributor

Adds style and default export conditions for ./styles.css.

Copilot AI lite review requested due to automatic review settings August 11, 2026 17:15
@esezen
esezen requested a review from a team as a code owner August 11, 2026 17:15

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 updates the package’s conditional exports to better support consuming the published ./styles.css entry via tooling that recognizes style and/or relies on a default fallback condition.

Changes:

  • Adds a "style" export condition for ./styles.css pointing at the built stylesheet.
  • Adds a "default" export condition for ./styles.css as a fallback alongside existing "import"/"require" mappings.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@constructor-claude-bedrock constructor-claude-bedrock Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Code Review

This PR adds style and default export conditions for ./styles.css in package.json. The style condition is a useful addition for bundlers like Vite and webpack, but the default condition is incorrectly configured and the require condition may be silently bypassed.

Inline comments: 2 discussions added

Overall Assessment: ⚠️ Needs Work

Comment thread package.json
"import": "./lib/mjs/styles.css",
"require": "./lib/cjs/styles.css"
"require": "./lib/cjs/styles.css",
"default": "./lib/mjs/styles.css"

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Important Issue: The "default" condition points to the MJS version, but "default" is a catch-all fallback that matches any environment not already matched by a prior condition. Because CSS files are module-system agnostic, CommonJS consumers that happen to hit "default" (e.g., bundlers that don't explicitly activate the require condition) will receive ./lib/mjs/styles.css instead of the intended ./lib/cjs/styles.css.

If a separate CJS stylesheet is needed, "default" should point to the CJS path for maximum compatibility:

"default": "./lib/cjs/styles.css"

Alternatively, if both CSS files are identical in content (very common for stylesheets), a single shared file can be used for all three conditions (style, import/require, and default), eliminating the ambiguity entirely.

Comment thread package.json
"types": "lib/types/index.d.ts",
"exports": {
"./styles.css": {
"style": "./lib/mjs/styles.css",

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Suggestion: The "style" condition is a non-standard, community convention recognised by bundlers such as Vite, webpack, and Parcel to identify CSS entry points. It is a welcome addition. However, since CSS files carry no ESM/CJS semantics, consider whether having two separate build artefacts (lib/mjs/styles.css and lib/cjs/styles.css) is actually necessary. If the compiled output is identical, a single lib/styles.css referenced by all conditions would simplify the copy-styles build script and remove the need for the "default" condition ambiguity discussed above.

@seantanyurong seantanyurong left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🚢 once tests in passing state

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