Skip to content

Commit aa6870a

Browse files
arunodarauchg
authored andcommitted
Fix #204 (#401)
React addons require React in a special way. That causes Webpack to push React into the app's bundle. This fix adds new externals entries to prevent that.
1 parent 45e36fd commit aa6870a

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

server/build/webpack.js

+6-1
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,12 @@ export default async function createCompiler (dir, { hotReload = false, dev = fa
184184
[require.resolve('../../lib/link')]: 'next/link',
185185
[require.resolve('../../lib/prefetch')]: 'next/prefetch',
186186
[require.resolve('../../lib/css')]: 'next/css',
187-
[require.resolve('../../lib/head')]: 'next/head'
187+
[require.resolve('../../lib/head')]: 'next/head',
188+
// React addons ask for React like this.
189+
// That causes webpack to push react into the app's bundle.
190+
// This fix simply prevents that and ask to use React from the next-bundle
191+
'./React': 'react',
192+
'./ReactDOM': 'react-dom'
188193
}
189194
],
190195
resolve: {

0 commit comments

Comments
 (0)