Vanilla Extract Component Library + Gatsby
See original GitHub issueDescribe the bug
I’ve been trying to write a components library based on Vanilla Extract and then consume the components on one of my Gatsby projects.
The problem is that on the consumer side, I’m getting the (in)famous error:
Styles were unable to be assigned to a file. This is generally caused by one of the following:
- You may have created styles outside of a '.css.ts' context
- You may have incorrect configuration. See https://vanilla-extract.style/documentation/setup
Link to reproduction
Components Library Gatsby Project
Steps to reproduce
- Clone the gatsby project
- npm install
- npm start
- in your preferred browser, visit
localhost:8000
System Info
System:
OS: macOS Mojave 10.14.6
CPU: (8) x64 Intel(R) Core(TM) i7-8559U CPU @ 2.70GHz
Memory: 2.08 GB / 16.00 GB
Shell: 3.2.57 - /bin/bash
npmPackages:
@vanilla-extract/babel-plugin: ^1.1.2 => 1.1.2
gatsby: ^4.1.1 => 4.1.1
react: ^17.0.1 => 17.0.2
react-dom: ^17.0.1 => 17.0.2
vanilla-extract-components: github:RaulEscobarRivas/vanilla-extract-components => 0.0.1
Disclaimer
I’m not entirely sure if this is a problem with Vanilla Extract or my components library setup, but I couldn’t find any components library out there using vanilla extract as base, so apologies in advance if this is unrelated!
Issue Analytics
- State:
- Created 2 years ago
- Comments:8 (1 by maintainers)
Top Results From Across the Web
Vanilla Extract Component Library + Gatsby · Issue #458
I've been trying to write a components library based on Vanilla Extract and then consume the components on one of my Gatsby projects....
Read more >gatsby-plugin-vanilla-extract
gatsby -plugin-vanilla-extract. Gatsby plugin which wraps the vanilla-extract project for easy use in Gatsby. Setup.
Read more >Gatsby - Vanilla Extract
Gatsby. A plugin for integrating vanilla-extract with Gatsby. Installation.
Read more >@vanilla-extract/css-utils examples - CodeSandbox
Learn how to use @vanilla-extract/css-utils by viewing and forking example apps that make use of @vanilla-extract/css-utils on CodeSandbox. ; vanilla-extract- ...
Read more >vanilla-extract/css NPM
To add to your Gatsby site, use the gatsby-plugin-vanilla-extract plugin. Rollup. Note: This option is useful for library development but not suitable for ......
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 FreeTop 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
Top GitHub Comments
Facing the same error but with a different setup I’m using Vanilla + Vite + Storybook
I created the issue here https://github.com/seek-oss/vanilla-extract/issues/835 I have the same problem. Started a vite storybook as documented in https://storybook.js.org/blog/storybook-for-vite/ and then added Vanilla extract
Edit :
FYI @madebydor I found the aswer, posted the answer in the issue mentioned above. The trick was to add :
At the end of the main.js file in the
.storybook
folderFacing the same error but with a different setup I’m using Vanilla + Vite + Storybook
Any solution?