question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

styled-jsx css.resolve errors after upgrading to React 17.0.0/Next 9.5.5

See original GitHub issue

Bug report

Describe the bug

After upgrading our Next.js application to React 17.0.0 and Next.js 9.5.5, our builds are failing with the following TypeError when parsing styled-jsx’s resolve calls:

TypeError: pass.get(...) is not a function

This only seems to happen when resolve is called outside of a jsx/tsx file. You can see a working example here: https://codesandbox.io/s/elegant-bassi-tbx5c?file=/pages/index.tsx (as opposed to the reproduction sandbox below).

I’m struggling to find the cause of these errors, as this pattern is working fine for us on React 16.x and Next.js 9.5.5. Could this be due to the new JSX transform support?

To Reproduce

CodeSandbox reproduction:

https://codesandbox.io/s/nice-bose-85uux?file=/lib/styles.ts

Expected behavior

The build should succeed without errors.

System information

  • OS: any
  • Version of Next.js: 9.5.5
  • Version of Node.js: 10.20.1 / 12.11.1

Additional context

N/A

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:14
  • Comments:14 (2 by maintainers)

github_iconTop GitHub Comments

5reactions
trekinbamicommented, Oct 27, 2020

Don’t know if I’m much help, but I’m getting the same error after I installed babel-plugin-inline-react-svg.

This breaks (pass.get(...) is not a function):

import ArrowRightIcon from '../../assets/icons/arrow_right.svg';
export { ArrowRightIcon };

While this works:

import ArrowRightIcon from '../../assets/icons/arrow_right.svg';
export const ArrowRight = <ArrowRightIcon />;
4reactions
lucax88xcommented, Nov 26, 2020

@Timer can we reopen this?

Read more comments on GitHub >

github_iconTop Results From Across the Web

styled-jsx - npm
Full CSS support for JSX without compromises. Latest version: 5.1.1, ... Start using styled-jsx in your project by running `npm i styled-jsx`.
Read more >
Use styled-jsx without ejecting create-react-app - Stack Overflow
According to the styled-jsx docs, it can be used in create-react-app by using the css.resolve function provided in styled-jsx/macro .
Read more >
Next.js 4: React 16 and styled-jsx 2 - Vercel
We are happy to introduce Next.js 4, which features support for React 16 and introduces a major upgrade for the default styling engine ......
Read more >
Compare Packages Between Distributions - DistroWatch.com
Please select two distributions and then a specific version of each distribution to compare. ... adobe-reader-9.5.5 ... aeson-better-errors-0.9.1.1
Read more >
Styling Next.js with Styled JSX
Styled JSX is a CSS-in-JS library that allows you to write encapsulated and scoped CSS to style your components. This blog post will...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found