UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
(node:1812) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that arenot handled will terminate the Node.js process with a non-zero exit code.
非常抱歉哈, mp-webpack-plugin 在 0.8.1 版本在处理 projectConfig 参数时缺少判断,现已修复到 0.8.2 版本。
看下配置是不是to参数没有传呢
src/index.js 335行这句有问题
generateConfig.projectConfig默认是 undefined,自然跑不通。所以就挂了。
const projectConfigPath = path.join(path.relative(outputPath, generateConfig.projectConfig), './project.config.json') || '../project.config.json'
记得好像是因为mp-webpack-plugin版本造成
0.8.1的版本作者不计后果的加了一个 projectConfig 自定义路径
解决办法
npm i mp-webpack-plugin@0.8.0 -D
2.在 mp.config.js 里
{ generate: { projectConfig: '', }, // 其他配置... }
我也遇到这个问题,node.js版本是v12.16.1,具体错误信息:
UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1) (node:1812) [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.
我尝试在package.json中增加 --hide-modules --unhandled-rejections=strict 也是不通过