Skip to content

Calculated component style differs between Develop and Build/Serve #39289

@karjanme

Description

@karjanme

Preliminary Checks

Description

When viewing a website that has a component style calculated based on a media query, the style applied to the element in HTML differs from what was calculated/logged.

The issue is only present when building/serving the site.
Image

The issue does not reproduce when developing the site.
Image

Reproduction Link

https://github.com/karjanme/gatsby-bug

Steps to Reproduce

npm run develop

  1. Open a web browser with the window width exceeding 900px
  2. Load the website (http://localhost:8000/)
  3. The navigation component is displayed (correct)

npm run build & npm run serve

  1. Open a web browser with the window width exceeding 900px
  2. Load the website (http://localhost:9000/)
  3. The navigation component is not visible/displayed (incorrect)

Expected Result

The built/deployed website should show the navigation component on page load when the window width is greater than the min-width in the media query.

Actual Result

The built/deployed website does not show the navigation component on page load when the window width is

Environment

System:
    OS: Windows 10 10.0.19045
    CPU: (16) x64 Intel(R) Core(TM) i9-10885H CPU @ 2.40GHz
  Binaries:
    Node: 22.15.0 - C:\DevTools\NodeJS\v22.15.0\node.EXE
    Yarn: 1.22.21 - ~\AppData\Roaming\npm\yarn.CMD
    npm: 11.3.0 - C:\DevTools\NodeJS\v22.15.0\npm.CMD
  Languages:
    Python: 3.12.2
  Browsers:
    Edge: Chromium (127.0.2651.74)
  npmPackages:
    gatsby: ^5.15.0-next.2 => 5.15.0-next.2 
  npmGlobalPackages:
    gatsby-cli: 5.13.3

Config Flags

NONE

Metadata

Metadata

Assignees

No one assigned

    Labels

    status: triage neededIssue or pull request that need to be triaged and assigned to a reviewertype: bugAn issue or pull request relating to a bug in Gatsby

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions