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 opt-out?

See original GitHub issue

Is there currently a way to completely disable styled-jsx that’s bundled with Next.js? If not, it would be great to have this option as currently it sometimes clashes with other CSS solutions by doing preprocessing of its own.

See #2304 and I’ve also been having issues with importing plain CSS through wrap-in-js.

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:1
  • Comments:12 (8 by maintainers)

github_iconTop GitHub Comments

3reactions
Cinamonascommented, Jul 2, 2017

@arunoda, maybe I’m missing something, but I’m not using it anywhere explicitly, and it still parses (and breaks) the stylesheet that I’m importing directly from node_modules (which I then injectGlobal through styled-components).

Right now, this is how I opt-out:

// babel-preset.js
const preset = require('next/babel');

preset.plugins = removeStyledJsx(preset.plugins);

module.exports = preset;

function removeStyledJsx(plugins) {
  return plugins.filter(plugin => plugin.indexOf('styled-jsx') === -1);
}
// .babelrc
{
  "presets": [
    "./babel-preset"
  ],
  // …
}

And this fixes the issues that I’m having.

1reaction
Sly777commented, Jul 4, 2017

On the last versions of next.js-styled comp-babel styled comp, There is no problem. I tried on my package (https://github.com/Sly777/ran) and It works without getting error. FYI, @arunoda 😃

Read more comments on GitHub >

github_iconTop Results From Across the Web

no-styled-jsx-in-document - Next.js
Why This Error Occurred. Custom CSS like styled-jsx is not allowed in a Custom Document. Possible Ways to Fix It. If you need...
Read more >
Static files, styled-jsx and CSS modules in Next.js
js allows you to basically to whatever you want it to about static files and your CSS code. If you want to opt...
Read more >
Using Styled JSX With React
Styled JSX is a CSS-in-JS library that allows you to write encapsulated and scoped CSS to style your components. The styles you introduce...
Read more >
Unknown property 'jsx' in diferents files using styled-jsx
I am doing a deployment in aws amplify of my application but I get an error when doing the deployment on an unknown...
Read more >
Styled components, the styling library for your React apps you ...
There are a ton of ways to style components in React. ... When you start out styling your React components you may opt...
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