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.

"Cannot read property 'rules' of undefined" after upgrading to styled components v4

See original GitHub issue

Seems System.js will generate a styled component without a ‘componentStyle’ attribute in some cases. Having a tough time putting my finger on what could be the solution.

styled-components.browser.esm.js:1736 Uncaught TypeError: Cannot read property 'rules' of undefined
    at createStyledComponent (styled-components.browser.esm.js:1736)
    at templateFunction (styled-components.browser.esm.js:1971)
    at eval (index.js:32)
    at System.create (System.js:117)
    at eval (Box.js:17)
    at Object../node_modules/grid-styled/dist/Box.js (commons.js:2940)
    at __webpack_require__ (commons.js:725)
    at fn (commons.js:102)
    at eval (index.js:7)
    at Object../node_modules/grid-styled/dist/index.js (commons.js:2964)

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:3
  • Comments:15 (7 by maintainers)

github_iconTop GitHub Comments

2reactions
jxnblkcommented, Sep 8, 2018

Just published v2.3.0 which might work with SC v4 if you wanna test it out

1reaction
gi-aleccommented, Sep 10, 2018

2.3.0 resolved the error 😃 I did get a warning after updating. Running npm dedupe resolved the duplicate instances warning.

Read more comments on GitHub >

github_iconTop Results From Across the Web

"Cannot read property 'rules' of undefined" after upgrading to styled ...
Seems System.js will generate a styled component without a 'componentStyle' attribute in some cases. Having a tough time putting my finger on what...
Read more >
Styled Component in React: TypeError: Cannot read property ...
1 Answer 1 ; import React · Component · from ; 'react' · import · Button · from ; 'react-bootstrap' · import ·...
Read more >
FAQs - styled-components
Commonly asked questions about styled-components.
Read more >
cannot read properties of undefined (reading 'displayname ...
Apparently, I was importing a Navbar, my component's name is Header. Also there is a difference between export default function () {} and...
Read more >
Upgrading styled-components from v3 to v4 - Formidable Labs
The v4 release of styled-components comes with a lot of features and ... We got "Cannot read property path of undefined" because the...
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