Unverified Commit 15854f51 authored by Tim Neutkens's avatar Tim Neutkens Committed by GitHub

Transpile styled-jsx into server bundle (#5588)

Drops an additional 6MB from the next-server node_modules size as there's no lodash
parent 745b2da0
......@@ -36,7 +36,6 @@
"path-to-regexp": "2.1.0",
"prop-types": "15.6.2",
"send": "0.16.1",
"styled-jsx": "3.1.0",
"url": "0.11.0"
},
"peerDependencies": {
......
......@@ -31,7 +31,7 @@ function externalsConfig (dir, isServer) {
return externals
}
const notExternalModules = ['next/app', 'next/document', 'next/error', 'http-status', 'styled-jsx']
const notExternalModules = ['next/app', 'next/document', 'next/error', 'http-status']
externals.push((context, request, callback) => {
if (notExternalModules.indexOf(request) !== -1) {
......@@ -53,6 +53,11 @@ function externalsConfig (dir, isServer) {
return callback()
}
// styled-jsx has to be transpiled
if (res.match(/node_modules[/\\]styled-jsx/)) {
return callback()
}
if (res.match(/node_modules[/\\].*\.js$/)) {
return callback(null, `commonjs ${request}`)
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment