mui / material-ui

Material UI: Comprehensive React component library that implements Google's Material Design. Free forever.
https://mui.com/material-ui/
MIT License
93.98k stars 32.29k forks source link

What might cause gatsby build to create such different HTML compared to gatsby develop? #18277

Closed kpennell closed 5 years ago

kpennell commented 5 years ago

Using 4.6

Current Behavior 😯

I'm just struggling for 8+ hours with a gatsby build vs. gatsby develop issue. The app looks/works one way with gatsby develop (the right way) and then the styling goes to hell when using gatsby build

gatsby build creates a footer that takes up half of the page

image

I've tried:

Expected Behavior 🤔

gatsby develop creates a functioning footer player like so image

It's odd really, the HTML in my code editor looks like this:

image But the html in my browser after gatsby build has Grids + containers in it:

image

Steps to Reproduce 🕹

So the oddest thing is that it seems to work fine in codesandbox

https://codesandbox.io/s/github/kpennell/berlinmusicmap/tree/master/?fontsize=14

https://v0i41.sse.codesandbox.io/ image

Context 🔦

I think there's still many many oddities in how Gatsby and Material-UI play together. These allude to it: https://github.com/gatsbyjs/gatsby/issues/8560 https://github.com/gatsbyjs/gatsby/issues/9911

Your Environment 🌎

System: OS: macOS 10.14 CPU: (4) x64 Intel(R) Core(TM) i5-5257U CPU @ 2.70GHz Shell: 3.2.57 - /bin/bash Binaries: Node: 12.12.0 - /usr/local/bin/node Yarn: 1.19.1 - /usr/local/bin/yarn npm: 6.11.3 - /usr/local/bin/npm Languages: Python: 2.7.10 - /usr/bin/python Browsers: Chrome: 78.0.3904.97 Firefox: 70.0.1 Safari: 12.0 npmPackages: gatsby: ^2.17.10 => 2.17.10 gatsby-cli: ^2.8.8 => 2.8.8 gatsby-image: ^2.2.29 => 2.2.30 gatsby-plugin-layout: ^1.1.13 => 1.1.13 gatsby-plugin-manifest: ^2.2.25 => 2.2.26 gatsby-plugin-material-ui: ^2.1.6 => 2.1.6 gatsby-plugin-netlify: ^2.1.23 => 2.1.23 gatsby-plugin-offline: ^3.0.18 => 3.0.18 gatsby-plugin-react-helmet: ^3.0.10 => 3.1.13 gatsby-plugin-remote-images: ^1.0.7 => 1.0.7 gatsby-plugin-sharp: ^2.2.36 => 2.2.36 gatsby-remark-copy-linked-files: ^2.0.11 => 2.1.28 gatsby-remark-images: ^3.0.1 => 3.1.29 gatsby-remark-relative-images: ^0.2.1 => 0.2.3 gatsby-source-filesystem: ^2.1.35 => 2.1.35 gatsby-transformer-remark: ^2.3.4 => 2.6.32 gatsby-transformer-sharp: ^2.1.9 => 2.3.2 npmGlobalPackages: gatsby-cli: 2.8.8

support[bot] commented 5 years ago

👋 Thanks for using Material-UI!

We use GitHub issues exclusively as a bug and feature requests tracker, however, this issue appears to be a support request.

For support, please check out https://material-ui.com/getting-started/support/. Thanks!

If you have a question on StackOverflow, you are welcome to link to it here, it might help others. If your issue is subsequently confirmed as a bug, and the report follows the issue template, it can be reopened.

mbrookes commented 5 years ago

@kpennell If you can narrow this down to a specific reproducible issue that is caused by Material-UI, feel free to reopen.

oliviertassinari commented 5 years ago

I had a quick look, it's definitely a support question regarding how Gatsby works. tip: gatsby-browser.js !== gatsby-ssr.js.

kpennell commented 5 years ago

@oliviertassinari Thanks for the response and all the work you do.

kpennell commented 5 years ago

I (seemingly) solved this by literally copying what I had gatsby-browser.js to gatsby-ssr.js (wrapRootElement + wrapPageElement). I'm still not totally sure why this worked -- I'll need to read more about these in Gatsby's docs.

Dear frustrated/lost person from the future seeing wacky different CSS between gatsby develop and gatsby build ....if you're using React Context, try verbatim copying your wrapRootElement/wrapPageElement between the two files.

kpennell commented 5 years ago

Thanks @oliviertassinari

ankit-iotasol commented 3 years ago

Hey guys I am getting the same issue. Can you please tell me the detailed solution for this?