next.js: Next 2.3.0 Build Errors
Failed to build on /var/folders/ys/lmdgwcfx4vv8w60w68ztzdfm0000gn/T/e219bf14-76f7-492a-b13c-545576e427fb
{ Error: ./~/react-tap-event-plugin/src/injectTapEventPlugin.js
Module not found: Error: Can't resolve 'react-dom/lib/EventPluginHub' in '/Users/tknipfer/Desktop/plate/node_modules/react-tap-event-plugin/src'
resolve 'react-dom/lib/EventPluginHub' in '/Users/tknipfer/Desktop/plate/node_modules/react-tap-event-plugin/src'
Parsed request is a module
using description file: /Users/tknipfer/Desktop/plate/node_modules/react-tap-event-plugin/package.json (relative path: ./src)
Running into this when doing a build with the latest next release
Note from maintainers:
Fix
next.config.js
module.exports = {
webpack: function (c) {
if (c.resolve.alias) {
delete c.resolve.alias['react']
delete c.resolve.alias['react-dom']
}
return c
}
}
About this issue
- Original URL
- State: closed
- Created 10 years ago
- Reactions: 23
- Comments: 24 (9 by maintainers)
Commits related to this issue
- add next building config. via: https://github.com/zeit/next.js/issues/1877 — committed to noriaki/bus-time-table-web by noriaki 10 years ago
- Fix build issue for react dom: https://github.com/zeit/next.js/issues/1877 — committed to ngjaying/xmhouse-client by johnyellow 9 years ago
- Workaround for https://github.com/zeit/next.js/issues/1877 — committed to Khan/OpenResponses by deleted user 9 years ago
@chhuang I understand that. Let me see what we can do about this. For now, we can try to remove these aliases using a custom webpack config.
EDIT: I’ve tested ^^ code and it works.
Getting a similar error when building with 2.3.1 but with different lib.
Thank you.
@chhuang I got the same error. wrapping the deletes with
if (config.resolve.alias)allowed me to run locally, as:I am able to run build and start a local server after changing
next.config.jsbut I still cannot push up to Heroku. Is it because I customized.babelrcfor Ant Design, as suggested in issues #484?Solved For people having the same issue as me, move
babel-plugin-importfromdevDependenciestodependencies, because it doesn’t push up to Heroku for production otherwise.Set
starttonext start -p $PORTand add"heroku-postbuild": "next build"in package.json.@arunoda I think you forgot to change
ctoconfigin your suggestionThank you @arunoda. The above config fixed the issue for me.
@arunoda Thanks! I’ve put up a sample repo, running
npm run buildwill fail:https://github.com/chhuang/next.js/tree/master/examples/basic-css
I’m getting the same error for
ReactTransitionGroupon 2.2Edit: sorry, I’m on 2.3.1. My build passes with 2.2