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

Resolve styled-jsx/style when transpiling ES2015 modules. #953

Merged
merged 1 commit into from
Feb 2, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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