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

Make styled-jsx configurable #3050

Merged
merged 6 commits into from
Oct 15, 2017

Conversation

timneutkens
Copy link
Member

For the upcoming plugins in v2 vercel/styled-jsx#291. Continuation of #2991

@giuseppeg
Copy link
Contributor

@timneutkens ok I looked into this and unfortunately we need to resolve the plugins paths:

function styledJsxOptions(opts) {
  if (!opts) return {}
  if (!Array.isArray(opts.plugins)) return opts
  opts.plugins = opts.plugins.map(plugin => {
    if (Array.isArray(plugin)) {
      return [
        require.resolve(plugin[0]),
        plugin[1]
      ]
    }
    return require.resolve(plugin)
  })
  return opts
}
[require.resolve('styled-jsx/babel'), styledJsxOptions(opts['styled-jsx'])]

@timneutkens
Copy link
Member Author

timneutkens commented Oct 13, 2017

Okay, lets move it to next.config.js then 👍 Since babelrc doesn't support javascript

@giuseppeg
Copy link
Contributor

@timneutkens your call, my example would work in server/build/babel/preset.js

@timneutkens
Copy link
Member Author

timneutkens commented Oct 13, 2017

@giuseppeg oh right, can simply use that and allow the user to use pretty names 😄 👍 Will add it later 👌

@giuseppeg
Copy link
Contributor

@timneutkens if you want I can add the changes to this branch

@timneutkens
Copy link
Member Author

@giuseppeg no worries I'll add them 👍

@timneutkens timneutkens merged commit e9d1461 into vercel:master Oct 15, 2017
@timneutkens timneutkens deleted the feature/configure-styled-jsx branch October 15, 2017 17:55
timneutkens added a commit to timneutkens/next.js that referenced this pull request Oct 15, 2017
* Make styled-jsx configurable

* Add styled-jsx-plugin-postcss example

* Add styled-jsx 2.1.0 with plugins support

* Move examples around and add description

* Add link to new example
@lock
Copy link

lock bot commented May 10, 2018

This thread has been automatically locked because it has not had recent activity. Please open a new issue for related bugs and link to relevant comments in this thread.

@lock lock bot locked as resolved and limited conversation to collaborators May 10, 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

Successfully merging this pull request may close these issues.

2 participants