Migré mi aplicación de angular 10 a 11 y la actualicé a webpack 5 usando:
"resolutions": { "webpack": "^5.0.0" }
Cuando construí/serví, recibí la siguiente advertencia =
(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)
¿Alguna idea de lo que debo hacer? reemplazar todo Array por Set? y ¿dónde puedo poner este node --trace-deprecation
en mi aplicación para saber qué archivo causa este problema?
Gracias.
ACTUALIZAR
Agregué --trace-deprecation durante la compilación y obtuve los siguientes registros:
(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
Actualmente, Angular 11 con Webpack 5 aún es experimental y funciona con Yarn solo como se menciona aquí . Por lo tanto, es posible que vea algunas advertencias y errores aquí y allá. Creo que es mejor evitar compilaciones de producción con él por ahora.
Lo más probable es que sea oficialmente compatible con Angular 12. Puede ver aquí que la biblioteca @angular-devkit/build-optimizer será compatible con Webpack 5 en la versión 12.