Skip to content

Removed vite-plugin-css-injected-by-js from portal#28975

Merged
9larsons merged 1 commit into
mainfrom
remove-portal-css-injected-plugin
Jun 29, 2026
Merged

Removed vite-plugin-css-injected-by-js from portal#28975
9larsons merged 1 commit into
mainfrom
remove-portal-css-injected-plugin

Conversation

@9larsons

Copy link
Copy Markdown
Contributor

Portal's two top-level CSS imports (src/app.css, src/index.css) are empty stubs. All real styles flow through ?inline imports in src/components/frame.styles.js, which inject <style> tags into the <head> of each Portal iframe at runtime — independent of Vite's CSS pipeline.

With nothing in the CSS graph to extract, the plugin was guarding against a problem that no longer exists. Vite's library mode already honours build.cssCodeSplit: false (kept in this config), so no separate .css asset is emitted alongside portal.min.js.

Verification

  • pnpm build before/after: single umd/portal.min.js in both cases, no .css sibling, sizes within 21 bytes (2,461,273 → 2,461,294).
  • Iframe <style> injection markers (createElement('style'), appendChild) unchanged at 15 occurrences in the bundle — those come from the Frame component, not the removed plugin.
  • pnpm test:unit in apps/portal: 582 passed / 1 skipped (these tests render the full React tree including iframe frames with ?inline CSS).
  • UMD bundle loaded in a synthetic harness via Playwright: parses, mounts, componentDidMount runs — only console error is the expected ECONNREFUSED to the fake API.
  • Bumped @tryghost/portal to 2.69.14; check-app-version-bump passes (defaults.json pins 2.69 major.minor).

@coderabbitai

coderabbitai Bot commented Jun 29, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 0757e404-7f9d-4f8c-90d0-8911d9cc0908

📥 Commits

Reviewing files that changed from the base of the PR and between b0c7e8c and 045cee6.

⛔ Files ignored due to path filters (1)
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
📒 Files selected for processing (2)
  • apps/portal/package.json
  • apps/portal/vite.config.mjs
💤 Files with no reviewable changes (1)
  • apps/portal/vite.config.mjs

Walkthrough

The vite-plugin-css-injected-by-js package is removed from the Portal app. Its import and cssInjectedByJsPlugin() registration are deleted from vite.config.mjs, and the corresponding devDependencies entry is removed from package.json. The package version is bumped from 2.69.15 to 2.69.16.

Possibly related PRs

  • TryGhost/Ghost#28973: Also modifies apps/portal/vite.config.mjs to remove now-unnecessary Vite plugin configuration and related build entry/loader settings.
🚥 Pre-merge checks | ✅ 4
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly matches the main change: removing vite-plugin-css-injected-by-js from Portal.
Description check ✅ Passed The description is directly related to the plugin removal and explains the rationale and verification.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch remove-portal-css-injected-plugin

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@nx-cloud

nx-cloud Bot commented Jun 29, 2026

Copy link
Copy Markdown

🤖 Nx Cloud AI Fix

Ensure the fix-ci command is configured to always run in your CI pipeline to get automatic fixes in future runs. For more information, please see https://nx.dev/ci/features/self-healing-ci


View your CI Pipeline Execution ↗ for commit 045cee6

Command Status Duration Result
nx run @tryghost/admin-x-settings:test:acceptance ✅ Succeeded 10m 5s View ↗
nx run ghost:test:integration ✅ Succeeded 2m 40s View ↗
nx run ghost:test:ci:integration ✅ Succeeded 3s View ↗
nx run ghost:test:legacy ✅ Succeeded 2m 48s View ↗
nx run-many --target=build --projects=tag:publi... ✅ Succeeded 3s View ↗
nx run ghost:test:e2e ✅ Succeeded 2m 23s View ↗
nx run-many -t test:unit -p @tryghost/portal,@t... ✅ Succeeded 1m 25s View ↗
nx run @tryghost/comments-ui:test:acceptance ✅ Succeeded 46s View ↗
Additional runs (7) ✅ Succeeded ... View ↗

💡 Verify your cache is correct by running tasks in a sandbox. Read docs ↗


☁️ Nx Cloud last updated this comment at 2026-06-29 22:11:21 UTC

@codecov

codecov Bot commented Jun 29, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 74.31%. Comparing base (f69be69) to head (045cee6).
⚠️ Report is 3 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main   #28975   +/-   ##
=======================================
  Coverage   74.31%   74.31%           
=======================================
  Files        1562     1562           
  Lines      135348   135348           
  Branches    16448    16450    +2     
=======================================
+ Hits       100588   100589    +1     
+ Misses      33732    33731    -1     
  Partials     1028     1028           
Flag Coverage Δ
e2e-tests 76.46% <ø> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 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.

no ref

Portal's two top-level CSS imports (`src/app.css`, `src/index.css`) are
empty stubs. All real styles flow through `?inline` imports in
`src/components/frame.styles.js`, which inject `<style>` tags into the
`<head>` of each Portal iframe at runtime — independent of Vite's CSS
pipeline.

With nothing in the CSS graph to extract, the plugin was guarding
against a problem that no longer exists. Vite's library mode already
honours `build.cssCodeSplit: false` (kept in this config), so no
separate `.css` asset is emitted alongside `portal.min.js`.

Verified locally: pre/post `pnpm build` produces a single
`umd/portal.min.js` (no `.css` sibling), byte sizes within 21 bytes of
each other, iframe style-injection markers unchanged.
@9larsons 9larsons force-pushed the remove-portal-css-injected-plugin branch from 1c1a634 to 045cee6 Compare June 29, 2026 21:58
@9larsons 9larsons marked this pull request as ready for review June 29, 2026 21:59
@9larsons 9larsons enabled auto-merge (squash) June 29, 2026 22:00
@9larsons 9larsons merged commit 03bed4a into main Jun 29, 2026
47 checks passed
@9larsons 9larsons deleted the remove-portal-css-injected-plugin branch June 29, 2026 22:11
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.

1 participant