Skip to content

Commit

Permalink
Resolve styled-jsx/style when transpiling ES2015 modules. (#953)
Browse files Browse the repository at this point in the history
  • Loading branch information
arunoda authored and timneutkens committed Feb 2, 2017
1 parent f971734 commit 24edfbd
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 2 deletions.
3 changes: 1 addition & 2 deletions server/build/babel/preset.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,7 @@ module.exports = {
'next/css': require.resolve('../../../lib/css'),
'next/head': require.resolve('../../../lib/head'),
'next/document': require.resolve('../../../server/document'),
'next/router': require.resolve('../../../lib/router'),
'styled-jsx/style': require.resolve('styled-jsx/style')
'next/router': require.resolve('../../../lib/router')
}
}
]
Expand Down
15 changes: 15 additions & 0 deletions server/build/webpack.js
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,21 @@ export default async function createCompiler (dir, { dev = false, quiet = false
const transpiled = babelCore.transform(content, {
presets: [require.resolve('babel-preset-es2015')],
sourceMaps: dev ? 'both' : false,
// Here we need to resolve styled-jsx/style to the absolute paths.
// Earlier we did it with the babel-preset.
// But since we don't transpile ES2015 in the preset this is not resolving.
// That's why we need to do it here.
// See more: https://github.com/zeit/next.js/issues/951
plugins: [
[
require.resolve('babel-plugin-module-resolver'),
{
alias: {
'styled-jsx/style': require.resolve('styled-jsx/style')
}
}
]
],
inputSourceMap: sourceMap
})

Expand Down

0 comments on commit 24edfbd

Please sign in to comment.