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

Babel plugin should process require('styled-jsx/css') #689

Open
jaydenseric opened this issue Dec 22, 2020 · 0 comments
Open

Babel plugin should process require('styled-jsx/css') #689

jaydenseric opened this issue Dec 22, 2020 · 0 comments

Comments

@jaydenseric
Copy link
Contributor

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

Bug.

What is the current behavior?

The styled-jsx/babel Babel plugin only processes import statements with the styled-jsx/css specifier, and does not process the equivalent require expressions for when styled-jsx is used within CJS scripts.

The problem location in the code where only import declarations are visited for processing is here:

ImportDeclaration(path, state) {

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

Working ESM:

Babel REPL.

Screen Shot 2020-12-23 at 10 18 52 am

Not working CJS:

Babel REPL.

Screen Shot 2020-12-23 at 10 19 03 am

What is the expected behavior?

styled-jsx should be usable within a CJS script, meaning the styled-jsx/babel Babel plugin should process require expressions with a styled-jsx/css path.

Environment (include versions)

  • styled-jsx (version): v3.3.2

Did this work in previous versions?

No.

jaydenseric added a commit to jaydenseric/device-agnostic-ui that referenced this issue Dec 23, 2020
…ew JSX transform.

- Custom Babel plugins now run before and after the styled-jsx/babel plugin, to workaround vercel/styled-jsx#680 and vercel/styled-jsx#689 .
- Temporarily remove size-limit due to ai/size-limit#205 .
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

1 participant