MERN首页加载速度非常慢(10分钟),并且文件更改后没有重新编译吗?

时间:2019-03-12 22:30:20

标签: asynchronous webpack mern

我正在尝试在Windows 10上使用MERN 2.4,并且已经构建了标准入门应用程序。我有两个问题:

  • 使用npm start启动服务器后,立即会有消息

    [nodemon]观看扩展:js,json [nodemon]开始node index.js [nodemon]分叉 [nodemon]儿童pid:64452 [nodemon]观看14个文件

    但是,直到大约10分钟(或更长时间)之后,Windows控制台才给出任何输出,白色文本开始闪烁,最后出现消息webpack built,其值以万毫秒为单位。

  • 在服务器启动并运行时,我无法设法请求重新编译-我不明白该怎么做才能再次构建Webpack。我使用WebStorm编辑器,但是文件更改和Webpack的构建之间没有因果关系。我可以看到仅在重新启动npm start进程时才会发生重新编译,但是由于重新启动时间长,因此这不是解决方案,甚至没有。

总的来说,我有不能使用MERN的印象,但是我想很多人都在快乐地使用它。除此之外-没有用于全栈React + Node开发的替代栈(有人说这是不可能的,因为MongoDB是唯一支持Node + Express服务器端编程的异步体系结构的数据库)。

这是npm start的日志:

[nodemon] 1.17.5
[nodemon] reading config .\nodemon.json
[nodemon] to restart at any time, enter `rs`
[nodemon] or send SIGHUP to 55608 to restart
[nodemon] ignoring: .\.git/**/* node_modules/**/node_modules
[nodemon] watching: C:\Xampp\htdocs\SunCity\server/**/* C:\Xampp\htdocs\SunCity\Intl/**/*
[nodemon] watching extensions: js,json
[nodemon] starting `node index.js`
[nodemon] forking
[nodemon] child pid: 58988
[nodemon] watching 14 files
(node:58508) DeprecationWarning: loaderUtils.parseQuery() received a non-string value which can be problematic, see https://github.com/webpack/loader-utils/issues/56
parseQuery() will be replaced with getOptions() in the next major version of loader-utils.
(node:44160) DeprecationWarning: loaderUtils.parseQuery() received a non-string value which can be problematic, see https://github.com/webpack/loader-utils/issues/56
parseQuery() will be replaced with getOptions() in the next major version of loader-utils.
(node:58988) DeprecationWarning: `open()` is deprecated in mongoose >= 4.11.0, use `openUri()` instead, or set the `useMongoClient` option if using `connect()` or `createConnection()`. See http://mongoosejs.com/docs/4.x/docs/connections.html#use-mongo-client
MERN is running on port: 8000! Build something amazing!
(node:58988) DeprecationWarning: loaderUtils.parseQuery() received a non-string value which can be problematic, see https://github.com/webpack/loader-utils/issues/56
parseQuery() will be replaced with getOptions() in the next major version of loader-utils.
webpack built 3d1508356639404fe210 in 5630ms
Terminate batch job (Y/N)? Y

0 个答案:

没有答案