Skip to content

Commit 24edfbd

Browse files
arunodatimneutkens
authored andcommitted
Resolve styled-jsx/style when transpiling ES2015 modules. (vercel#953)
1 parent f971734 commit 24edfbd

File tree

2 files changed

+16
-2
lines changed

2 files changed

+16
-2
lines changed

server/build/babel/preset.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,7 @@ module.exports = {
2626
'next/css': require.resolve('../../../lib/css'),
2727
'next/head': require.resolve('../../../lib/head'),
2828
'next/document': require.resolve('../../../server/document'),
29-
'next/router': require.resolve('../../../lib/router'),
30-
'styled-jsx/style': require.resolve('styled-jsx/style')
29+
'next/router': require.resolve('../../../lib/router')
3130
}
3231
}
3332
]

server/build/webpack.js

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -158,6 +158,21 @@ export default async function createCompiler (dir, { dev = false, quiet = false
158158
const transpiled = babelCore.transform(content, {
159159
presets: [require.resolve('babel-preset-es2015')],
160160
sourceMaps: dev ? 'both' : false,
161+
// Here we need to resolve styled-jsx/style to the absolute paths.
162+
// Earlier we did it with the babel-preset.
163+
// But since we don't transpile ES2015 in the preset this is not resolving.
164+
// That's why we need to do it here.
165+
// See more: https://github.com/zeit/next.js/issues/951
166+
plugins: [
167+
[
168+
require.resolve('babel-plugin-module-resolver'),
169+
{
170+
alias: {
171+
'styled-jsx/style': require.resolve('styled-jsx/style')
172+
}
173+
}
174+
]
175+
],
161176
inputSourceMap: sourceMap
162177
})
163178

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy