Commit 2f6e43f5 authored by Mariano Fernández Cocirio's avatar Mariano Fernández Cocirio Committed by Tim Neutkens

Update styled-jsx-postcss example (#3083)

* Update babel-preset.js

As './dist/server/build/babel/preset' now return a function, in this example we need to first call the function and after that replace styled-jsx

* linting issues solved
parent a25cb412
const nextBabelPreset = require('next/babel') const nextBabelPreset = require('next/babel')
nextBabelPreset.plugins = nextBabelPreset.plugins.map(plugin => { /*
This code will load the 'styled-jsx-postcss/babel' package instead
of built-in 'styled-jsx/babel'
*/
let presetArray = nextBabelPreset()
presetArray.plugins = presetArray.plugins.map(plugin => {
if (!Array.isArray(plugin) && plugin.indexOf('styled-jsx/babel') !== -1) { if (!Array.isArray(plugin) && plugin.indexOf('styled-jsx/babel') !== -1) {
return require.resolve('styled-jsx-postcss/babel') return require.resolve('styled-jsx-postcss/babel')
} }
return plugin return plugin
}) })
module.exports = nextBabelPreset module.exports = presetArray
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment