Webpack Dev Server 和 Babel 依赖项警告: 解决方案与解释
"setupMiddlewares" option. (Use `node --trace-deprecation ...` to show where the warning was created)(node:15264) [DEP_WEBPACK_DEV_SERVER_ON_BEFORE_SETUP_MIDDLEWARE] DeprecationWarning: 'onBeforeSetupMiddleware' option is deprecated. Please use the 'setupMiddlewares' option. One of your dependencies, babel-preset-react-app, is importing the "@babel/plugin-proposal-private-property-in-object" package without declaring it in its dependencies. This is currently working because "@babel/plugin-proposal-private-property-in-object" is already in your node_modules folder for unrelated reasons, but it may break at any time. 这些是警告信息,而不是错误。警告信息提醒你使用了已经被弃用的选项或者某个依赖项可能会在未来的版本中出现问题。第一个警告是关于 Webpack Dev Server 的 onBeforeSetupMiddleware 选项已经被废弃,建议使用 setupMiddlewares 选项替代。第二个警告是关于一个依赖项 babel-preset-react-app 未在其依赖中声明导入的 @babel/plugin-proposal-private-property-in-object 包。尽管当前代码可能正常工作,但是这可能会在未来的版本中出现问题。你可以使用 node --trace-deprecation ... 命令来显示警告信息的产生位置。
原文地址: https://www.cveoy.top/t/topic/pVpg 著作权归作者所有。请勿转载和采集!