Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

When building a Vite+React project, a "/*#__PURE__*/" warning is shown for every component using styled with props #1428

Open
rodrigocfd opened this issue Dec 9, 2024 · 0 comments
Labels
bug report 🦗 Issue is probably a bug, but it needs to be checked bundler: rollup 🗞️ Issue is related to rollup bundler needs: complete repro 🖥️ Issue need to have complete repro provided

Comments

@rodrigocfd
Copy link

Environment

  • React : 18.3.1
  • TypeScript: 5.7.2
  • @linaria/core: 6.2.0
  • @linaria/react: 6.2.1
  • @wyw-in-js/vite: 0.5.5
  • Bundler: Vite 6.0.3
  • Node.js version: 22.12.0
  • OS: Windows 10 x64

Description

When passing any prop to a component, the following warning appears in npm run build:

src/App.tsx (1:21): A comment

"/*#__PURE__*/"

in "src/App.tsx" contains an annotation that Rollup cannot interpret due to the
position of the comment. The comment will be removed to avoid issues.

During npm run dev no warnings are displayed.

Reproducible Demo

import {styled} from '@linaria/react';

export default function App() {
    return <Div color='red'>Hello</Div>;
}

const Div = styled.div<{color: string}>`
    color: ${props => props.color}
`;

I attached a zip with the minimal reproducible project:

@rodrigocfd rodrigocfd added bug report 🦗 Issue is probably a bug, but it needs to be checked needs: complete repro 🖥️ Issue need to have complete repro provided needs: triage 🏷 Issue needs to be checked and prioritized labels Dec 9, 2024
@github-actions github-actions bot added bundler: rollup 🗞️ Issue is related to rollup bundler and removed needs: triage 🏷 Issue needs to be checked and prioritized labels Dec 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug report 🦗 Issue is probably a bug, but it needs to be checked bundler: rollup 🗞️ Issue is related to rollup bundler needs: complete repro 🖥️ Issue need to have complete repro provided
Projects
None yet
Development

No branches or pull requests

1 participant