Skip to content

Conversation

@richard-elastique
Copy link

@richard-elastique richard-elastique commented Jun 6, 2025

PR Checklist

Please check if your PR fulfills the following requirements:

PR Type

What kind of change does this PR introduce?

  • Bugfix
  • Feature
  • Code style update (formatting, local variables)
  • Refactoring (no functional changes, no api changes)
  • Build related changes
  • CI related changes
  • Documentation content changes
  • Application (the showcase website) / infrastructure changes
  • Other... Please describe:

What is the current behavior?

#7928 add support for style exports in the package.json. But the index.min.css file is not exported.
Scherm­afbeelding 2025-06-06 om 14 54 54

Issue Number: N/A

What is the new behavior?

Add the index.min.css file as exported in the same way as the index.less

Does this PR introduce a breaking change?

  • Yes
  • No

@zorro-bot
Copy link

zorro-bot bot commented Jun 6, 2025

This preview will be available after the AzureCI is passed.

@codecov
Copy link

codecov bot commented Jun 6, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 90.86%. Comparing base (ae9ad57) to head (f160fb5).
⚠️ Report is 5 commits behind head on master.

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #9162   +/-   ##
=======================================
  Coverage   90.86%   90.86%           
=======================================
  Files         574      574           
  Lines       23261    23261           
  Branches     4639     4639           
=======================================
  Hits        21135    21135           
  Misses       1393     1393           
  Partials      733      733           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@Nicoss54 Nicoss54 requested review from Laffery and Nicoss54 June 6, 2025 13:40
Copy link
Collaborator

@Nicoss54 Nicoss54 left a comment

Choose a reason for hiding this comment

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

LGTM, @Laffery could you confirm ?

@richard-elastique
Copy link
Author

richard-elastique commented Jun 6, 2025

It may be a bigger issue, it seems I cannot import the individual component styles either. For now I have a workaround, will read a bit more about style exports to see what is wrong.

I think this occurs in combination with the new Angular application builder and scss as styles.

How do you do your import ??

if you did it like this

@import 'relative_path_to_node_modules/node_modules/ng-zorro/button/style/index.min.css

it will not work ?

@richard-elastique
Copy link
Author

richard-elastique commented Jun 6, 2025

Import with the node_modules path included does work.

@import "../node_modules/ng-zorro-antd/style/index.min.css";

But with esbuild, that Angular application builder uses, it should work like this. Unfortunately the compiler complains about the styles not being exported.

@import "ng-zorro-antd/style/index.min.css";

@Nicoss54
Copy link
Collaborator

Nicoss54 commented Jun 6, 2025

@richard-elastique i tried to reproduce you problem, but it work on my side, could you give us a reproduction link please ?

@richard-elastique
Copy link
Author

@richard-elastique richard-elastique changed the title Export css in package json Fix css exports in package json Jun 6, 2025
@richard-elastique
Copy link
Author

Having the less and style exports separate seems to fix the problem.

@Nicoss54
Copy link
Collaborator

@Laffery @HyperLife1119 could you take a look ?

Copy link

Copilot AI left a comment

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 fixes the CSS exports configuration in package.json to properly expose the index.min.css files for all components. Previously, the exports configuration only included LESS file mappings for component styles. This change splits the single wildcard export for each component into separate entries for LESS and CSS files, and adds a new root-level wildcard export for CSS files.

Key changes:

  • Split each component's style export from a single wildcard pattern into separate LESS and CSS exports
  • Added root-level ./*.css export mapping
  • Added watermark component style exports

"less": "./affix/style/*.less"
},
"./affix/style/*.css": {
"style": "./affix/style/index.min.css"
Copy link

Copilot AI Dec 1, 2025

Choose a reason for hiding this comment

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

The CSS wildcard pattern ./affix/style/*.css maps to a specific file ./affix/style/index.min.css instead of preserving the wildcard. This means consumers can request any CSS file path matching the pattern (e.g., ./affix/style/custom.css), but they will always receive index.min.css. This is inconsistent with the LESS export pattern on line 81 which correctly preserves the wildcard with ./affix/style/*.less. Consider changing the style value to ./affix/style/*.css to allow resolution of any CSS file, or update the pattern to be more specific like ./affix/style/index*.css to clarify that only index files are available.

Suggested change
"style": "./affix/style/index.min.css"
"style": "./affix/style/*.css"

Copilot uses AI. Check for mistakes.
Comment on lines +77 to +79
"./*.css": {
"style": "./*.css"
},
Copy link

Copilot AI Dec 1, 2025

Choose a reason for hiding this comment

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

The root-level CSS export pattern ./*.css correctly preserves the wildcard (unlike the component-specific patterns), which creates inconsistency in the exports configuration. If the intention is to allow access to any root-level CSS file, this is correct. However, this inconsistency with component-level CSS exports (which map to specific index.min.css files) may confuse consumers. Consider documenting this behavior or making the patterns consistent throughout.

Suggested change
"./*.css": {
"style": "./*.css"
},
// Removed wildcard root-level CSS export for consistency with component-level exports

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants