1
0
Fork 0
mirror of https://github.com/terribleplan/next.js.git synced 2024-01-19 02:48:18 +00:00
next.js/examples/with-styled-jsx-postcss/babel-preset.js
Mariano Fernández Cocirio 2f6e43f57f 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
2017-10-13 23:28:42 +02:00

18 lines
436 B
JavaScript

const nextBabelPreset = require('next/babel')
/*
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 = presetArray