Some CSS Modules Do Not Load

Open
#3,870 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
1-2 days
Newbie friendliness
48/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Quiet
Tech stack
css, deno, typescript
Domain
frontend

Research direction

Start by running the linked reproduction with deno task dev and deno task build, then compare the generated CSS assets with the entryAssets array in _fresh/server/server-entry.mjs. The issue does not identify the Fresh source file responsible, so trace how CSS Module assets are discovered and included in the HTML. Done when affected CSS Modules load in both development and the built site without manually editing generated files.

Written by the indexing model from the issue text.

Description

(Please see https://github.com/StarFahx/DenoCssBugRepro for a repo with reproduction steps for this bug. I've copied out the info from the readme file there below:)

I've come across a bug that seems quite inconsistent to recreate. I've not been able to figure out a "minimal" reproduction: it seems to strike in the middle of development with no particular rhyme or reason, so I have taken the most recent project I was working on when it struck and removed any identifying features.

The issue is that sometimes Deno decides not to load in a css module (or sass module, if using sass-embedded: which I often do, but I've recreated the issue here from scratch with pure css modules only). When running deno task dev, the module(s) that are affected will not appear in the html at all; when running deno task build, the relevant css appears in _fresh/client/assets/server-entry-{hash}.css, which is not loaded into the html either. This I think is the key to figuring out why it's inconsistent and why only some modules are affected, but I'm not familiar enough with Fresh to hunt this down myself right now.

I am able to work around the issue by updating _fresh/server/server-entry.mjs manually: an entryAssets const is declared, and if the server-entry css file path is added to the array manually, the modules load as expected. This is not a particularly helpful workaround when developing as it only works with a production built version of the site, and does not therefore have file-tracking or any other useful dev features!

Recreation Steps

  1. Pull this repo
  2. In /src, run deno task dev
  3. Opening the site in your browser (I am using Firefox v152.0.1, and running Deno v2.8.3 on Linux), confirm that the whole content of the page is full-width
  4. Confirm the same for the site hosted using deno task build && deno serve --allow-read _fresh/server.js.
  5. Amend _fresh/server/server-entry.mjs as described in the workaround above.
  6. Re-run the script in step 4 and confirm that most (but not all) of the content is fit to a central container, and that the title text is red.
Dominant language
TypeScript
Stars
13.8k
Forks
757
Avg merge
3m
Merged PRs (30d)
2

Getting set up

This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from freshframework/fresh

All issues in freshframework/fresh

Similar issues

More TypeScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.