1
0
Fork 0
mirror of https://github.com/terribleplan/next.js.git synced 2024-01-19 02:48:18 +00:00

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
This commit is contained in:
Mariano Fernández Cocirio 2017-10-13 18:28:42 -03:00 committed by Tim Neutkens
parent a25cb412bf
commit 2f6e43f57f

View file

@ -1,10 +1,17 @@
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) {
return require.resolve('styled-jsx-postcss/babel')
}
return plugin
})
module.exports = nextBabelPreset
module.exports = presetArray