server is listening to 3333启动后,报‘mode’ option has not been set

来源:2-8 开发时的服务端渲染

慕莱坞4101375

2018-03-30


server is listening to 3333
configuration
The 'mode' option has not been set. Set 'mode' option to 'development' or 'production' to enable defaults for this environment.
(node:5300) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1): ReferenceError: ReactDomServer is not defined
(node:5300) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
(node:5300) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 2): ReferenceError: ReactDomServer is not defined
(node:5300) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 3): ReferenceError: ReactDomServer is not defined
(node:5300) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 4): ReferenceError: ReactDomServer is not defined
(node:5300) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 5): ReferenceError: ReactDomServer is not defined
(node:5300) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 6): ReferenceError: ReactDomServer is not defined

写回答

2回答

Jokcy

2018-03-30

你用的是webpack4,需要设置mode选项

0
1
慕莱坞4101375
非常感谢!按照教程来写的代码,如果是4,mode要怎么设置?
2018-04-02
共1条回复

慕莱坞4101375

提问者

2018-04-02

其实我是按照视频搭建的环境,同样的配置,因为版本3一直报错,所以才用了webpack@4.0.0-beta.1 问题解决了。后续跟着视频往下做,就出现了mode问题。@Jokcy 。请问,如果往下继续跟着视频做,我是不是要换回来版本3.0比较好?@Jokcy


0
1
Jokcy
webpack配置后面改动不多,而且大部分配置都是通用的,只要走通问题不大
2018-04-02
共1条回复

React全栈+服务器渲染(ssr)打造社区Webapp

【毕设面试】只会写业务代码?out了,带你学会搭建属于自己的工程!

768 学习 · 414 问题

查看课程