You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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 to eval 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.
Module build failed (from ../../node_modules/@vanilla-extract/webpack-plugin/loader/dist/vanilla-extract-webpack-plugin-loader.cjs.js):
NonErrorEmittedError: (Emitted value instead of an instance of Error) TypeError: Cannot read properties of undefined (reading 'register')
Validations
Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.
From #905 the recommended change is to do with SplitChunks, no changes I made had any effect
#894 / #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 effect
#894 / #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.
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
The text was updated successfully, but these errors were encountered: