mirror of
https://github.com/terribleplan/next.js.git
synced 2024-01-19 02:48:18 +00:00
Remove aliasing of react and react-dom (#3731)
* Remove aliasing of react and react-dom We need that functionality, but React does it automatically. So, we don't need to do that. This also fixes #3711 otherwise we need to add a few more aliases. * Revert "Remove aliasing of react and react-dom" This reverts commit 929d9567bbdc3f369f13888e846e848a25c9c261. * Allow to import modules like 'react-dom/server'. We do this by doing an extact match for 'react' and 'react-dom'
This commit is contained in:
parent
d7941438dd
commit
efe9afb2be
|
@ -149,10 +149,15 @@ export default async function getBaseWebpackConfig (dir, {dev = false, isServer
|
||||||
],
|
],
|
||||||
alias: {
|
alias: {
|
||||||
next: nextDir,
|
next: nextDir,
|
||||||
// This bypasses React's check for production mode. Since we know it is in production this way.
|
// React already does something similar to this.
|
||||||
// This allows us to exclude React from being uglified. Saving multiple seconds per build.
|
// But if the user has react-devtools, it'll throw an error showing that
|
||||||
react: dev ? 'react/cjs/react.development.js' : 'react/cjs/react.production.min.js',
|
// we haven't done dead code elimination (via uglifyjs).
|
||||||
'react-dom': dev ? 'react-dom/cjs/react-dom.development.js' : 'react-dom/cjs/react-dom.production.min.js'
|
// We purposly do not uglify React code to save the build time.
|
||||||
|
// (But it didn't increase the overall build size)
|
||||||
|
// Here we are doing an exact match with '$'
|
||||||
|
// So, you can still require nested modules like `react-dom/server`
|
||||||
|
react$: dev ? 'react/cjs/react.development.js' : 'react/cjs/react.production.min.js',
|
||||||
|
'react-dom$': dev ? 'react-dom/cjs/react-dom.development.js' : 'react-dom/cjs/react-dom.production.min.js'
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
resolveLoader: {
|
resolveLoader: {
|
||||||
|
|
Loading…
Reference in a new issue