Skip to content

chore: do not inject css and build pure esm - #124

Merged
susnux merged 1 commit into
mainfrom
chore/simplif
Oct 7, 2026
Merged

susnux merged 1 commit into
mainfrom
chore/simplif

Conversation

@susnux

@susnux susnux commented Oct 6, 2026

Copy link
Copy Markdown
Contributor

all other libraries also already switched to esm only, so as this library also has some of them as a dependency an app does not work if they cannot bundle esm. Meaning there is no reason to not also go esm only and drop additional complexity of having a second cjs bundle.

Moreover the bundled CSS might be a good case for libraries apps that cannot handle CSS imports, but if your app uses nextcloud-vue it already has to handle that.
More important injecting CSS will make the app always include the viewer CSS within their JS bundles which has a performance impact. Especially when the app opts for split CSS and JS to reduce browsers JS parsing time.

🤖 AI (if applicable)

- [ ] The content of this PR was partly or fully generated using AI

@codecov

codecov Bot commented Oct 6, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 92.82%. Comparing base (9d32f5b) to head (193e6a7).

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #124   +/-   ##
=======================================
  Coverage   92.82%   92.82%           
=======================================
  Files          47       47           
  Lines        4069     4069           
  Branches      813      813           
=======================================
  Hits         3777     3777           
  Misses        273      273           
  Partials       19       19           

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

@skjnldsv skjnldsv 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.

Ok then! I remember there was a reason I wanted the old injected css, but I don't recall anymore 🤔

@susnux
susnux marked this pull request as ready for review October 7, 2026 09:20
all other libraries also already switched to esm only,
so as this library also has some of them as a dependency an app does not
work if they cannot bundle esm. Meaning there is no reason to not also
go esm only and drop additional complexity of having a second cjs
bundle.

Moreover the bundled CSS might be a good case for libraries apps that
cannot handle CSS imports, but if your app uses nextcloud-vue it already
has to handle that.
More important injecting CSS will make the app always include the viewer
CSS within their JS bundles which has a performance impact.
Especially when the app opts for split CSS and JS to reduce browsers JS
parsing time.

Signed-off-by: Ferdinand Thiessen <opensource@fthiessen.de>
@susnux
susnux merged commit 789469f into main Oct 7, 2026
20 checks passed
@susnux
susnux deleted the chore/simplif branch October 7, 2026 09:56
@skjnldsv

skjnldsv commented Oct 7, 2026

Copy link
Copy Markdown
Contributor

But that does mean apps needs to manually import the lib css ? @susnux

@susnux

susnux commented Oct 8, 2026

Copy link
Copy Markdown
Contributor Author

But that does mean apps needs to manually import the lib css ?

No its the same as with nextcloud-vue. Its injected by apps where needed - or extracted if desired.
So by default a nextcloud app will include the css in the modules that will need it automatically again.

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.

2 participants