使用 web pack 5 在 angular 11 中设置警告的 WEBPACK 弃用数组
WEBPACK deprecation array to set warning in angular 11 using web pack 5
我将我的应用程序从 angular 10 迁移到 11,并使用 :
更新到 webpack 5
"resolutions": {
"webpack": "^5.0.0"
}
当我 ng build/serve 我收到以下警告 =
(node:3926) [DEP_WEBPACK_DEPRECATION_ARRAY_TO_SET_INDEXER] DeprecationWarning: chunk.files was changed from Array to Set (indexing Array is deprecated)
(Use `node --trace-deprecation ...` to show where the warning was created)
知道我该怎么做吗?用集合替换所有数组?我可以将此 node --trace-deprecation
放在我的应用程序中的什么位置,以便了解导致此问题的文件?
谢谢。
更新
我在构建过程中添加了 --trace-deprecation 并获得了以下日志:
(node:12987) [DEP_WEBPACK_DEPRECATION_ARRAY_TO_SET_INDEXER] DeprecationWarning: chunk.files was changed from Array to Set (indexing Array is deprecated)
at Set.fn (/Users/xxxxx/node_modules/webpack/lib/util/deprecation.js:128:4)
at xxx/node_modules/@angular-devkit/build-angular/src/webpack/plugins/analytics.js:173:57
at Array.forEach (<anonymous>)
at NgBuildAnalyticsPlugin._collectBundleStats (/xxxx/node_modules/@angular-devkit/build-angular/src/webpack/plugins/analytics.js:172:14)
at NgBuildAnalyticsPlugin._done (/xxx/node_modules/@angular-devkit/build-angular/src/webpack/plugins/analytics.js:242:14)
at Hook.eval [as callAsync] (eval at create (/xxx/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:14:1)
at Hook.CALL_ASYNC_DELEGATE [as _callAsync] (/xxx/node_modules/tapable/lib/Hook.js:18:14)
at /xxx/node_modules/webpack/lib/Compiler.js:468:23
at Compiler.emitRecords (/xxx/node_modules/webpack/lib/Compiler.js:846:39)
at /xxx/node_modules/webpack/lib/Compiler.js:460:11
我将我的应用程序从 angular 10 迁移到 11,并使用 :
更新到 webpack 5 "resolutions": {
"webpack": "^5.0.0"
}
当我 ng build/serve 我收到以下警告 =
(node:3926) [DEP_WEBPACK_DEPRECATION_ARRAY_TO_SET_INDEXER] DeprecationWarning: chunk.files was changed from Array to Set (indexing Array is deprecated)
(Use `node --trace-deprecation ...` to show where the warning was created)
知道我该怎么做吗?用集合替换所有数组?我可以将此 node --trace-deprecation
放在我的应用程序中的什么位置,以便了解导致此问题的文件?
谢谢。
更新
我在构建过程中添加了 --trace-deprecation 并获得了以下日志:
(node:12987) [DEP_WEBPACK_DEPRECATION_ARRAY_TO_SET_INDEXER] DeprecationWarning: chunk.files was changed from Array to Set (indexing Array is deprecated)
at Set.fn (/Users/xxxxx/node_modules/webpack/lib/util/deprecation.js:128:4)
at xxx/node_modules/@angular-devkit/build-angular/src/webpack/plugins/analytics.js:173:57
at Array.forEach (<anonymous>)
at NgBuildAnalyticsPlugin._collectBundleStats (/xxxx/node_modules/@angular-devkit/build-angular/src/webpack/plugins/analytics.js:172:14)
at NgBuildAnalyticsPlugin._done (/xxx/node_modules/@angular-devkit/build-angular/src/webpack/plugins/analytics.js:242:14)
at Hook.eval [as callAsync] (eval at create (/xxx/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:14:1)
at Hook.CALL_ASYNC_DELEGATE [as _callAsync] (/xxx/node_modules/tapable/lib/Hook.js:18:14)
at /xxx/node_modules/webpack/lib/Compiler.js:468:23
at Compiler.emitRecords (/xxx/node_modules/webpack/lib/Compiler.js:846:39)
at /xxx/node_modules/webpack/lib/Compiler.js:460:11