styled-jsx icon indicating copy to clipboard operation
styled-jsx copied to clipboard

`import css from 'styled-jsx/css'` fails for external files

Open opudalo opened this issue 4 years ago • 1 comments

Do you want to request a feature or report a bug?

bug

What is the current behavior?

Can not import styled-jsx/css.

If the current behavior is a bug, please provide the steps to reproduce and possibly a minimal demo or testcase in the form of a Next.js app, CodeSandbox URL or similar

Codesandbox Importing styled-jsx/css in external files doesn't work. From README

What is the expected behavior?

Successful import in external files.

opudalo avatar Aug 28 '20 10:08 opudalo

I am having a similar problem when attempting to use the webpack loader (which, of course, wraps a css file using the css function).

I've ensured that the loader is registered before babel-loader. Using inline styled-jsx works fine, but once you do something like import styles from './mystyle.css' you get the following error:

css.js:2 Uncaught Error: styled-jsx/css: if you are getting this error it means that your `css` tagged template literals were not transpiled.

I have followed all the steps in the README and cannot find a workaround.

curiosity26 avatar Dec 01 '20 03:12 curiosity26