Open gabriel-naressi opened 2 months ago
I came here from the issue on vitest repo. The NodeJS usage is important for vitest to run with styled-components, since vitest run in the context of node.
The workaround from the vitest issue that worked also for me is to add the private package that depends on styled-components to test.server.deps.inline:
// vite.config.ts
export default defineConfig({
test: {
server: {
deps: {
inline: ["replace-with-your-package"],
}
}
},
});
Environment
Reproduction
https://stackblitz.com/edit/vitest-dev-vitest-mt2ebd?file=repro.mjs
Steps to reproduce
The reproduction is on the stackblitz link
Expected Behavior
NodeJS usage should be possible. This became an issue following a comment from one of the vite maintainers in this thread: https://github.com/vitest-dev/vitest/discussions/5286#discussioncomment-8624346.
Another useful link that shows the problem: https://publint.dev/styled-components@6.1.8
Actual Behavior