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

Support for styled-jsx #347

Closed
spd789562 opened this issue Dec 5, 2016 · 8 comments
Closed

Support for styled-jsx #347

spd789562 opened this issue Dec 5, 2016 · 8 comments

Comments

@spd789562
Copy link

Hi!
styled-jsx look cool!
Would you plan to add this in next?

@leo leo changed the title styled-jsx support? Support for styled-jsx Dec 5, 2016
@aga5tya
Copy link
Contributor

aga5tya commented Dec 7, 2016

I tried to use styled-jsx module, but end up with this error upon the basic example provided at the repo.

import _jsxStyleInject from 'styled-jsx/inject'; ^^^^^^ SyntaxError: Unexpected token import at Object.exports.runInThisContext (vm.js:76:16) at Module._compile (module.js:545:28)

Do i need to use a specific babel preset to get this working ? This is what i have put for babel config adding the plugin in package.json

"babel": { "plugins": [ "styled-jsx/babel" ] },

@sergiodxa
Copy link
Contributor

@aga5tya I think you need to add a plugin or preset to support ES2015 modules because the styled-jsx/babel plugin insert an import instead of a require.

@jlobos
Copy link
Contributor

jlobos commented Dec 8, 2016

in future next.js replace glamor to styled-jsx?

@aga5tya
Copy link
Contributor

aga5tya commented Dec 8, 2016

@sergiodxa, doesn't next.js support es6 modules out of the box?

@conor
Copy link

conor commented Dec 8, 2016

@aga5tya styled-jsx requires a babel transform plugin to work. Currently next.js doesn't expose the webpack config. My understanding is that they will give access to webpack config in the next release.

@aga5tya
Copy link
Contributor

aga5tya commented Dec 8, 2016

@conor @sergiodxa, I just checked the default webpack config being used,, i see a babel transform runtime plugin,, is there another one that is required or is the order that is causing the issue?

https://github.com/zeit/next.js/blob/master/server/build/webpack.js#L137

@conor
Copy link

conor commented Dec 8, 2016

@aga5tya you can see the required babel plugin on the README for styled-jsx.

I guess it would require this line to be added require.resolve('styled-jsx/babel'). Having said that there is work being done on this PR #222. So, I think it is best to wait for that. Because you will also need access to the server code in order to render on the server. This is coming in the Programmatic API #291.

@aga5tya
Copy link
Contributor

aga5tya commented Dec 8, 2016

@conor , sounds good,, thanks for pointing it. :)

@lock lock bot locked as resolved and limited conversation to collaborators May 12, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants