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

Runtime css tag error #7

Open
sandgraham opened this issue Jun 10, 2021 · 1 comment
Open

Runtime css tag error #7

sandgraham opened this issue Jun 10, 2021 · 1 comment

Comments

@sandgraham
Copy link

Hi, thanks for publishing this plugin!

I ran into a little trouble trying it out. As far as I can tell there is this odd flakey behavior where I get the following error:

css.ts:10 Uncaught Error: Using the "css" tag in runtime is not supported. Make sure you have set up the Babel plugin correctly.

This is with some code like this:

import { css } from "@linaria/core";
import React from "react";

const pretty = css`
  font-family: cursive;
`;

export function App() {
  return <div className={pretty}>hi</div>;
}

I say flakey because I've had a really hard time figuring out exactly how to reproduce it.

When I create a new vite react-ts project and setup linaria with this plugin, sometimes I get this error and sometimes I don't. I've re-scaffolded a new app about 5 times and 4 times I saw the error and 1 time I didn't.

What's odd is that if I add a styled component to the same file it usually starts working. If i remove the styled component from the file and restart the dev server I see the error again.

I'd send a reproduction but honestly I can't even isolate a state where it is consistent. Putting this issue up more to see if anyone else has run into this and knows what's going on.

Thanks.

@czabaj
Copy link

czabaj commented Jul 22, 2021

I had the same issue when I declared a style with a css tagged template.

It starts working after I assigned the style to the JSX className.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants