Site breaks on build/serve but works perfectly in develop
See original GitHub issueDescription
Here’s the repo (note: very much a WIP): https://github.com/TidyIQ/gatsby-themes
This works perfectly when I run it in development mode but once I build and serve it, everything breaks.
Here’s how it looks in develop: https://i.imgur.com/rqtMwoL.png
And in build/serve: https://i.imgur.com/Kmi1YCW.png
Steps to reproduce
Clone repo and install then run:
yarn workspace @tidyiq/gatsby-theme-tidyiq build
yarn workspace simple-site dev
Then run
yarn workspace simple-site build
yarn workspace simple-site serve
Expected result
No issue
Actual result
See screenshots above
Environment
System: OS: Windows 10 CPU: (4) x64 Intel® Core™ i5-7200U CPU @ 2.50GHz Binaries: Node: 10.15.3 - ~\AppData\Local\Temp\yarn–1564036881678-0.9003840083964854\node.CMD Yarn: 1.16.0 - ~\AppData\Local\Temp\yarn–1564036881678-0.9003840083964854\yarn.CMD npm: 6.10.0 - C:\Program Files\nodejs\npm.CMD Languages: Python: 2.7.16 - C:\Python27\python.EXE Browsers: Edge: 42.17134.1.0
Issue Analytics
- State:
- Created 4 years ago
- Reactions:2
- Comments:13 (1 by maintainers)
Top Results From Across the Web
Error Building Gatsby Site with PostCSS and TailwindCSS
I am creating a Gatsby Site with TailwindCSS and had set it up after watching a YouTube Video. Everything is working fine in...
Read more >What to Do When Your Website is Broken | Codementor
In this this article, we will show you 7 general steps to fix your website, application, or code when it's broken.
Read more >How do you make sure your website works properly?
In this article, we go over various troubleshooting steps for a website and some basic actions to take in order to solve these...
Read more >Deployment | Create React App
The last command shown above will serve your static site on the ... It also works well when integrated into an existing server...
Read more >How Internal Feedback Helps Us Develop TeamCity
JetBrains BuildServer FeedBack Day: How Internal Feedback Helps Us ... great for products that are designed for individual use, but it's ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Also, it works fine on the initial load for a millisecond or two, then it refreshes and breaks.
Annnd a bit more insight…
I realised that the CSS was only failing for the components I’ve imported from my custom gatsby theme. Basically, that form with the two imports and button are imported from the gatsby theme, while the Open Snackbar button is imported directly from Material UI (in node_modules) in the site itself.
The Open Snackbar button works fine. So the issue is with how Gatsby compiles the theme.
I added the following to my theme’s
gatsby-browser.js
andgatsby-ssr.js
files, and now it’s working:I’m not sure if this is optimal or if it’s going to cause performance and other issues, but it works now in production.
I won’t close this as I don’t believe the issue is resolved. The expected behaviour is that the production build should work exactly the same as the development build, and that is not the case.