-
-
Notifications
You must be signed in to change notification settings - Fork 106
Description
🐛 Bug Report
I am experiencing problems when using this library on a clean and fresh installation of GatsbyJS.
The project looks fine when it is being developed, but when a build is done and the project is executed it does not show the styles of the components.
I have created a public repository, if you can download and run the project npm run start
you can see on the localhost:8000
page that the navigation bar is displayed correctly, attached screenshot.
For more contect here is my Navbar component https://github.com/ChristianHardy/gatsby-xstyled/blob/main/src/components/Navbar/index.tsx

But if you make a build and then run that build: npm run build; npm run serve
you can see that the web does not load the styles, if dimensions, heights or responsive styles, I upload screenshots with my results.

But if you navigate between the two pages you will see that the styles are loaded later.

To Reproduce
- Clone the repository given
- Install the NPM modules running
npm run ci
- See the project running locally
npm run start
- Go to
localhost:8000
on any web browser and you will be able to see the navbar styled - Stop the previous process, build and serve locally the project running
npm run build; npm run serve
- Go to
localhost:9000
on any web browser, you will see the navbar unstyled - Use the navbar to navigate to another view, example
contact
and see how the navbar its styled now, even if you navigate tohome
again the style will still loaded.
Expected behavior
The components created with xstyled needs to keep the style even if the project its compiled for production environments
Link to repl or repo (highly encouraged)
https://github.com/ChristianHardy/gatsby-xstyled
Run npx envinfo --system --binaries --npmPackages @xstyled/system,@xstyled/styled-components,styled-components --markdown --clipboard
Paste the results here:
## System:
- OS: macOS 14.0
- CPU: (10) arm64 Apple M1 Pro
- Memory: 74.63 MB / 16.00 GB
- Shell: 3.6.0 - /opt/homebrew/bin/fish
## Binaries:
- Node: 18.12.1 - ~/.nvm/versions/node/v18.12.1/bin/node
- npm: 8.19.2 - ~/.nvm/versions/node/v18.12.1/bin/npm
## npmPackages:
- @xstyled/styled-components: ^3.8.0 => 3.8.0
- styled-components: ^6.0.7 => 6.0.7