Closed joerobot closed 11 months ago
From https://github.com/vanilla-extract-css/vanilla-extract/issues/905 the recommended change is to do with SplitChunks
, no changes I made had any effect
https://github.com/vanilla-extract-css/vanilla-extract/issues/894 / https://github.com/vanilla-extract-css/vanilla-extract/issues/1043 suggests moving pascal case files to a separate location, in this case would that mean creating separate bundles for components/non-components?
From #905 the recommended change is to do with
SplitChunks
, no changes I made had any effect894 / #1043 suggests moving pascal case files to a separate location, in this case would that mean creating separate bundles for components/non-components?
Yes, you'll need to create separate entrypoints within the same package if you want to expose both react components and styles. Your bundler should be able to handle this if you define multiple entrypoints in the package.json exports
key.
Thanks @askoufis I'll give that a go and report back!
@joerobot Any update on this?
Hi @askoufis sorry about the delay.
Yeah this one did work out! Thank you.
Describe the bug
Working with a Vanilla Extract based design system in a yarn workspaces monorepo with Gatsby (Webpack HMR/Fast Refresh) can sometimes trigger
__webpack_require__.$Refresh$
to be undefined. This results in a TypeError when@vanilla-extract/integration
tries toeval
the bundle.Interestingly, this issue doesn't seem to happen when using a version of the design system from a registry (eg npm), so possibly related to the symlinking involved with a monorepo.
Exploring other issues it seems to be related to importing a mix of react components and non-components. Some issues were resolved by adding a build step to the design system, which I am already doing with Vite.
In my reproduction I've tried condensing the button component to identify a single-line change that can trigger the issue but haven't been able to find a change that reliably causes the issue every time. With the Button at its current complexity, simply adding it to the design system bundle is enough to trigger the error.
Reproduction
https://github.com/joerobot/gatsby-vanilla-monorepo
System Info
Used Package Manager
yarn
Logs
Validations