cli: Add support for CSS exports in package build

This adds support for CSS entry points in package exports. When a package
declares a CSS file in its exports field, the CLI will now automatically
bundle it during `backstage-cli package build` and rewrite the export
path from src/ to dist/ at publish time.

The CSS bundling uses lightningcss to resolve @import statements and
preserves @layer declarations that would otherwise be stripped during
bundling.

This allows packages like @backstage/ui to use the standard build command
instead of custom build scripts for CSS bundling.

Signed-off-by: Patrik Oldsberg <poldsberg@gmail.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
Patrik Oldsberg
2026-02-09 13:35:19 +01:00
parent 5a5e9bb6bd
commit 4f9d980943
10 changed files with 122 additions and 9369 deletions
+1
View File
@@ -110,6 +110,7 @@
"inquirer": "^8.2.0",
"jest-css-modules": "^2.1.0",
"json-schema": "^0.4.0",
"lightningcss": "^1.29.1",
"lodash": "^4.17.21",
"minimatch": "^9.0.0",
"node-stdlib-browser": "^1.3.1",