Skip to content

vitest fails with component library with styled-components #5286

Answered by hi-ogawa
gabriel-naressi asked this question in Q&A
Discussion options

You must be logged in to vote

I assume @bee-ui/bee-ui is your private package, but it would be helpful if you can show how import styled from "styled-components"; is transpiled in the file @bee-ui/bee-ui/dist/main.js (It doesn't have to be a whole file, but just a top part of the file and also the lines around e.h1).

Without this, I cannot tell exactly, but it's likely that either @bee-ui/bee-ui or styled-components might have some packaging issue.
First thing I suggest is to put @bee-ui/bee-ui into server.deps.inline, which usually help to workaround certain packaging issues.

// vite.config.ts
export default defineConfig({
  test: {
    server: {
      deps: {
        inline: ["@bee-ui/bee-ui"],
      }
    }
  },
});

Replies: 7 comments 25 replies

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
25 replies
@hi-ogawa
Comment options

Answer selected by gabriel-naressi
@gabriel-naressi
Comment options

@hi-ogawa
Comment options

@gabriel-naressi
Comment options

@hi-ogawa
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
2 participants
Converted from issue

This discussion was converted from issue #5275 on February 24, 2024 03:13.