After the ant-design-pro project npm run build, the browser opens and reports an error.

simply write a project with ant-design-pro, and write a server.js and npm run build packaged file in the root directory with the built-in mock API,. The dist directory is as follows:

server.js:


server.js302Cannot read property "notifyCount" of undefined:

the user part remains unchanged, and the data sent from the server can be output normally in the console. I don"t understand what went wrong. After the browser can display, npm run build normally, npm start opens an error in browser 127.0.0.1, npm run build 9008. How can you solve this problem?


npm run build cannot be opened with self-written server.js

what does this mean? from the code point of view, server.js is a static resource service running on the server side, so why it should be packaged to dist, but cannot be run on the browser side, am I wrong?


the packaged project needs to be supported by the web container, that is, it needs to run into the web container, such as nginx.
mock data packaged out is invalid. In the case of build, the mock data is not packaged. You must point the address in the server.js to a service address, usually in the form of a proxy.

Menu