Skip to content
Snippets Groups Projects

simplify frontend CSS build in Webpack

Merged Administrator requested to merge simplify-webpack-css-build into master

Created by: sqs

Previously, our Webpack build had a separate set of entrypoints for CSS (vs. TypeScript). It also had a hack to avoid a red-herring 404 in the devtools browser console when running Sourcegraph in local dev (which does not produce .css output files; it uses style-loader to inject styles via JavaScript so we get hot-reloading, ie instant feedback for CSS changes).

Now, it only has a single set of (TypeScript) entrypoints that, in turn, import the relevant CSS files. Also, the hack was removed in favor of not emitting a <link rel="stylesheet" ...> tag when running Sourcegraph in local dev.

Merge request reports

Merged by avatar (Jul 5, 2025 4:27pm UTC)

Loading

Activity

Filter activity
  • Approvals
  • Assignees & reviewers
  • Comments (from bots)
  • Comments (from users)
  • Commits & branches
  • Edits
  • Labels
  • Lock status
  • Mentions
  • Merge request status
  • Tracking
  • Created by: codecov[bot]

    Codecov Report

    Merging #5266 into master will increase coverage by <.01%. The diff coverage is 100%.

    @@            Coverage Diff             @@
    ##           master    #5266      +/-   ##
    ==========================================
    + Coverage   45.69%   45.69%   +<.01%     
    ==========================================
      Files         735      735              
      Lines       45414    45415       +1     
      Branches     2605     2605              
    ==========================================
    + Hits        20751    20754       +3     
    + Misses      22655    22654       -1     
    + Partials     2008     2007       -1
    Impacted Files Coverage Δ
    cmd/frontend/internal/app/ui/handlers.go 42.42% <100%> (+0.43%) :arrow_up:
    ...d/frontend/internal/authz/bitbucketserver/store.go 74.01% <0%> (+0.98%) :arrow_up:
  • Created by: sqs

    In prod, nothing changes. It extracts all of our SCSS to a .css file and uses a link tag to include it.

    In dev, the only change is we no longer have a link tag that loads an empty .css file. It injects the styles into style tags.

    We don’t use code splitting on SCSS (all SCSS flies are imported from the entrypoint) so most of your questions are moot. But I’d love to start doing that soon.

  • Created by: felixfbecker

    Sounds good. Do you happen to know what would happen right now though?

  • Created by: sqs

    It would produce multiple .css files and we’d need a way to load them as needed.

Please register or sign in to reply
Loading