Angular 2 CLI + Webpack ng build - большое предупреждение

Мое приложение работает нормально. но когда я строю для производства, набрав

ng build --prod в своей консоли я получаю следующее гигантское предупреждение и странно dist выход:

WARNING in main.ff67c2edc2d42d6adb60.bundle.js from UglifyJs
Condition always true [main.ff67c2edc2d42d6adb60.bundle.js:235,5]
Dropping unreachable code [main.ff67c2edc2d42d6adb60.bundle.js:5310,4]
Declarations in unreachable code! [main.ff67c2edc2d42d6adb60.bundle.js:5310,4]
Side effects in initialization of unused variable TypeModifier [main.ff67c2edc2d42d6adb60.bundle.js:5476,4]
Side effects in initialization of unused variable BuiltinMethod [main.ff67c2edc2d42d6adb60.bundle.js:5732,4]
Side effects in initialization of unused variable StmtModifier [main.ff67c2edc2d42d6adb60.bundle.js:5966,4]
Side effects in initialization of unused variable freeExports [main.ff67c2edc2d42d6adb60.bundle.js:8176,4]
Side effects in initialization of unused variable freeModule [main.ff67c2edc2d42d6adb60.bundle.js:8177,4]
Side effects in initialization of unused variable ProviderAstType [main.ff67c2edc2d42d6adb60.bundle.js:9022,4]
Side effects in initialization of unused variable PropertyBindingType [main.ff67c2edc2d42d6adb60.bundle.js:9063,4]
Side effects in initialization of unused variable RequestMethod [main.ff67c2edc2d42d6adb60.bundle.js:9394,4]
Side effects in initialization of unused variable ReadyState [main.ff67c2edc2d42d6adb60.bundle.js:9409,4]
Side effects in initialization of unused variable ResponseType [main.ff67c2edc2d42d6adb60.bundle.js:9422,4]
Side effects in initialization of unused variable ContentType [main.ff67c2edc2d42d6adb60.bundle.js:9436,4]
Side effects in initialization of unused variable ResponseContentType [main.ff67c2edc2d42d6adb60.bundle.js:9447,4]
Side effects in initialization of unused variable TagContentType [main.ff67c2edc2d42d6adb60.bundle.js:11792,4]
Dropping unreachable code [main.ff67c2edc2d42d6adb60.bundle.js:12589,4]
Declarations in unreachable code! [main.ff67c2edc2d42d6adb60.bundle.js:12589,4]
Dropping unreachable code [main.ff67c2edc2d42d6adb60.bundle.js:15093,4]
Declarations in unreachable code! [main.ff67c2edc2d42d6adb60.bundle.js:15093,4]
Dropping unreachable code [main.ff67c2edc2d42d6adb60.bundle.js:15143,4]
Declarations in unreachable code! [main.ff67c2edc2d42d6adb60.bundle.js:15143,4]
Side effects in initialization of unused variable ViewType [main.ff67c2edc2d42d6adb60.bundle.js:19907,4]
Side effects in initialization of unused variable HTMLCollection [main.ff67c2edc2d42d6adb60.bundle.js:21081,4]
Dropping unreachable code [main.ff67c2edc2d42d6adb60.bundle.js:23278,4]
Declarations in unreachable code! [main.ff67c2edc2d42d6adb60.bundle.js:23278,4]
Dropping unreachable code [main.ff67c2edc2d42d6adb60.bundle.js:23323,4]
Declarations in unreachable code! [main.ff67c2edc2d42d6adb60.bundle.js:23323,4]
Side effects in initialization of unused variable HTMLCollection [main.ff67c2edc2d42d6adb60.bundle.js:25631,4]
Dropping unreachable code [main.ff67c2edc2d42d6adb60.bundle.js:27538,8]
Declarations in unreachable code! [main.ff67c2edc2d42d6adb60.bundle.js:27538,8]
Dropping unused variable SAFE_SRCSET_PATTERN [main.ff67c2edc2d42d6adb60.bundle.js:33759,4]
Dropping unreachable code [main.ff67c2edc2d42d6adb60.bundle.js:34293,4]
Declarations in unreachable code! [main.ff67c2edc2d42d6adb60.bundle.js:34293,4]
Dropping unreachable code [main.ff67c2edc2d42d6adb60.bundle.js:34392,4]
Declarations in unreachable code! [main.ff67c2edc2d42d6adb60.bundle.js:34392,4]
Dropping unreachable code [main.ff67c2edc2d42d6adb60.bundle.js:34498,4]
Declarations in unreachable code! [main.ff67c2edc2d42d6adb60.bundle.js:34498,4]
Dropping unreachable code [main.ff67c2edc2d42d6adb60.bundle.js:34603,4]
Declarations in unreachable code! [main.ff67c2edc2d42d6adb60.bundle.js:34603,4]
Condition always true [main.ff67c2edc2d42d6adb60.bundle.js:35538,4]
Condition always true [main.ff67c2edc2d42d6adb60.bundle.js:35616,4]
Condition always true [main.ff67c2edc2d42d6adb60.bundle.js:35679,4]
Condition always true [main.ff67c2edc2d42d6adb60.bundle.js:35786,4]
Condition always true [main.ff67c2edc2d42d6adb60.bundle.js:35851,4]
Condition always true [main.ff67c2edc2d42d6adb60.bundle.js:35990,4]
Condition always true [main.ff67c2edc2d42d6adb60.bundle.js:36101,4]
Condition always true [main.ff67c2edc2d42d6adb60.bundle.js:36237,4]
Condition always true [main.ff67c2edc2d42d6adb60.bundle.js:36331,4]
Condition always true [main.ff67c2edc2d42d6adb60.bundle.js:36454,4]
Condition always true [main.ff67c2edc2d42d6adb60.bundle.js:36577,4]
Condition always true [main.ff67c2edc2d42d6adb60.bundle.js:36690,4]
Condition always true [main.ff67c2edc2d42d6adb60.bundle.js:36836,4]
Condition always true [main.ff67c2edc2d42d6adb60.bundle.js:36921,4]
Dropping unreachable code [main.ff67c2edc2d42d6adb60.bundle.js:36945,16]
Dropping unreachable code [main.ff67c2edc2d42d6adb60.bundle.js:36954,16]
Dropping unreachable code [main.ff67c2edc2d42d6adb60.bundle.js:36963,16]
Dropping unreachable code [main.ff67c2edc2d42d6adb60.bundle.js:36972,16]
Dropping unreachable code [main.ff67c2edc2d42d6adb60.bundle.js:36981,16]
Condition always true [main.ff67c2edc2d42d6adb60.bundle.js:37097,4]
Condition always true [main.ff67c2edc2d42d6adb60.bundle.js:37164,4]
Condition always true [main.ff67c2edc2d42d6adb60.bundle.js:37248,4]
Condition always true [main.ff67c2edc2d42d6adb60.bundle.js:37315,4]
Condition always true [main.ff67c2edc2d42d6adb60.bundle.js:37397,4]
Condition always true [main.ff67c2edc2d42d6adb60.bundle.js:37477,4]
Condition always true [main.ff67c2edc2d42d6adb60.bundle.js:37580,4]
Condition always true [main.ff67c2edc2d42d6adb60.bundle.js:37681,4]
Condition always true [main.ff67c2edc2d42d6adb60.bundle.js:37752,4]
Condition always true [main.ff67c2edc2d42d6adb60.bundle.js:37819,4]
Condition always true [main.ff67c2edc2d42d6adb60.bundle.js:37890,4]
Condition always true [main.ff67c2edc2d42d6adb60.bundle.js:37960,4]
Condition always true [main.ff67c2edc2d42d6adb60.bundle.js:38033,4]
Condition always true [main.ff67c2edc2d42d6adb60.bundle.js:38107,4]
Condition always true [main.ff67c2edc2d42d6adb60.bundle.js:38192,4]
Condition always true [main.ff67c2edc2d42d6adb60.bundle.js:38278,4]
Condition always true [main.ff67c2edc2d42d6adb60.bundle.js:38361,4]
Condition always true [main.ff67c2edc2d42d6adb60.bundle.js:38431,4]
Condition always true [main.ff67c2edc2d42d6adb60.bundle.js:38541,4]
Condition always true [main.ff67c2edc2d42d6adb60.bundle.js:38652,4]
Condition always true [main.ff67c2edc2d42d6adb60.bundle.js:38716,4]
Condition always true [main.ff67c2edc2d42d6adb60.bundle.js:38780,4]
Condition always true [main.ff67c2edc2d42d6adb60.bundle.js:38848,4]
Condition always true [main.ff67c2edc2d42d6adb60.bundle.js:38916,4]
Condition always true [main.ff67c2edc2d42d6adb60.bundle.js:38993,4]
Condition always true [main.ff67c2edc2d42d6adb60.bundle.js:39073,4]
Condition always true [main.ff67c2edc2d42d6adb60.bundle.js:39156,4]
Condition always true [main.ff67c2edc2d42d6adb60.bundle.js:39257,4]
Condition always true [main.ff67c2edc2d42d6adb60.bundle.js:39385,4]
Condition always true [main.ff67c2edc2d42d6adb60.bundle.js:39534,4]
Dropping unused variable suffix [main.ff67c2edc2d42d6adb60.bundle.js:39543,12]
Condition always true [main.ff67c2edc2d42d6adb60.bundle.js:39647,4]
Condition always true [main.ff67c2edc2d42d6adb60.bundle.js:39747,4]
Condition always true [main.ff67c2edc2d42d6adb60.bundle.js:39833,4]
Condition always true [main.ff67c2edc2d42d6adb60.bundle.js:39965,4]
Condition always true [main.ff67c2edc2d42d6adb60.bundle.js:40038,4]
Condition always true [main.ff67c2edc2d42d6adb60.bundle.js:40119,4]
Condition always true [main.ff67c2edc2d42d6adb60.bundle.js:40205,4]
Condition always true [main.ff67c2edc2d42d6adb60.bundle.js:40298,4]
Condition always true [main.ff67c2edc2d42d6adb60.bundle.js:40389,4]
Condition always true [main.ff67c2edc2d42d6adb60.bundle.js:40455,4]
Condition always true [main.ff67c2edc2d42d6adb60.bundle.js:40523,4]
Condition always true [main.ff67c2edc2d42d6adb60.bundle.js:40615,4]
Condition always true [main.ff67c2edc2d42d6adb60.bundle.js:40755,4]
Condition always true [main.ff67c2edc2d42d6adb60.bundle.js:40829,4]
Condition always true [main.ff67c2edc2d42d6adb60.bundle.js:40951,4]
Condition always true [main.ff67c2edc2d42d6adb60.bundle.js:41051,4]
Condition always true [main.ff67c2edc2d42d6adb60.bundle.js:41166,4]
Condition always true [main.ff67c2edc2d42d6adb60.bundle.js:41260,4]
Condition always true [main.ff67c2edc2d42d6adb60.bundle.js:41346,4]
Condition always true [main.ff67c2edc2d42d6adb60.bundle.js:41509,4]
Condition always true [main.ff67c2edc2d42d6adb60.bundle.js:41595,4]
Condition always true [main.ff67c2edc2d42d6adb60.bundle.js:41681,4]
Condition always true [main.ff67c2edc2d42d6adb60.bundle.js:41779,4]
Condition always true [main.ff67c2edc2d42d6adb60.bundle.js:41845,4]
Condition always true [main.ff67c2edc2d42d6adb60.bundle.js:41972,4]
Condition always true [main.ff67c2edc2d42d6adb60.bundle.js:42049,4]
Condition always true [main.ff67c2edc2d42d6adb60.bundle.js:42113,4]
Condition always true [main.ff67c2edc2d42d6adb60.bundle.js:42241,4]
Condition always true [main.ff67c2edc2d42d6adb60.bundle.js:42350,4]
Condition always true [main.ff67c2edc2d42d6adb60.bundle.js:42415,4]
Condition always true [main.ff67c2edc2d42d6adb60.bundle.js:42485,4]
Condition always true [main.ff67c2edc2d42d6adb60.bundle.js:42565,4]
Condition always true [main.ff67c2edc2d42d6adb60.bundle.js:42750,4]
Condition always true [main.ff67c2edc2d42d6adb60.bundle.js:42815,4]
Condition always true [main.ff67c2edc2d42d6adb60.bundle.js:42891,4]
Dropping unreachable code [main.ff67c2edc2d42d6adb60.bundle.js:42915,16]
Dropping unreachable code [main.ff67c2edc2d42d6adb60.bundle.js:42924,16]
Dropping unreachable code [main.ff67c2edc2d42d6adb60.bundle.js:42933,16]
Dropping unreachable code [main.ff67c2edc2d42d6adb60.bundle.js:42942,16]
Dropping unreachable code [main.ff67c2edc2d42d6adb60.bundle.js:42951,16]
Condition always true [main.ff67c2edc2d42d6adb60.bundle.js:43044,4]
Condition always true [main.ff67c2edc2d42d6adb60.bundle.js:43212,4]
Condition always true [main.ff67c2edc2d42d6adb60.bundle.js:43284,4]
Condition always true [main.ff67c2edc2d42d6adb60.bundle.js:43398,4]
Condition always true [main.ff67c2edc2d42d6adb60.bundle.js:43512,4]
Condition always true [main.ff67c2edc2d42d6adb60.bundle.js:43605,4]
Condition always true [main.ff67c2edc2d42d6adb60.bundle.js:43678,4]
Condition always true [main.ff67c2edc2d42d6adb60.bundle.js:43741,4]
Condition always true [main.ff67c2edc2d42d6adb60.bundle.js:43874,4]
Condition always true [main.ff67c2edc2d42d6adb60.bundle.js:43967,4]
Condition always true [main.ff67c2edc2d42d6adb60.bundle.js:44038,4]
Condition always true [main.ff67c2edc2d42d6adb60.bundle.js:44104,4]
Condition always true [main.ff67c2edc2d42d6adb60.bundle.js:44229,4]
Condition always true [main.ff67c2edc2d42d6adb60.bundle.js:44322,4]
Condition always true [main.ff67c2edc2d42d6adb60.bundle.js:44417,4]
Condition always true [main.ff67c2edc2d42d6adb60.bundle.js:44479,4]
Condition always true [main.ff67c2edc2d42d6adb60.bundle.js:44542,4]
Condition always true [main.ff67c2edc2d42d6adb60.bundle.js:44691,4]
Condition always true [main.ff67c2edc2d42d6adb60.bundle.js:44753,4]
Condition always true [main.ff67c2edc2d42d6adb60.bundle.js:44836,4]
Condition always true [main.ff67c2edc2d42d6adb60.bundle.js:44909,4]
Condition always true [main.ff67c2edc2d42d6adb60.bundle.js:45040,4]
Side effects in initialization of unused variable matches [main.ff67c2edc2d42d6adb60.bundle.js:47583,12]
Dropping unused variable __unused [main.ff67c2edc2d42d6adb60.bundle.js:47891,4]
Non-strict equality against boolean: != true [main.ff67c2edc2d42d6adb60.bundle.js:49247,15]
Side effects in initialization of unused variable transitiveModuleMeta [main.ff67c2edc2d42d6adb60.bundle.js:50293,16]
Dropping unused variable EVENT [main.ff67c2edc2d42d6adb60.bundle.js:50654,4]
Side effects in initialization of unused variable SecurityContext [main.ff67c2edc2d42d6adb60.bundle.js:58783,4]
Dropping unreachable code [main.ff67c2edc2d42d6adb60.bundle.js:61560,4]
Declarations in unreachable code! [main.ff67c2edc2d42d6adb60.bundle.js:61560,4]
Dropping unreachable code [main.ff67c2edc2d42d6adb60.bundle.js:61730,4]
Declarations in unreachable code! [main.ff67c2edc2d42d6adb60.bundle.js:61730,4]
Dropping unreachable code [main.ff67c2edc2d42d6adb60.bundle.js:61842,4]
Declarations in unreachable code! [main.ff67c2edc2d42d6adb60.bundle.js:61842,4]
Dropping unreachable code [main.ff67c2edc2d42d6adb60.bundle.js:62014,4]
Declarations in unreachable code! [main.ff67c2edc2d42d6adb60.bundle.js:62014,4]
Dropping unreachable code [main.ff67c2edc2d42d6adb60.bundle.js:62075,4]
Declarations in unreachable code! [main.ff67c2edc2d42d6adb60.bundle.js:62075,4]
Dropping unreachable code [main.ff67c2edc2d42d6adb60.bundle.js:62180,4]
Declarations in unreachable code! [main.ff67c2edc2d42d6adb60.bundle.js:62180,4]
Dropping unreachable code [main.ff67c2edc2d42d6adb60.bundle.js:62667,4]
Declarations in unreachable code! [main.ff67c2edc2d42d6adb60.bundle.js:62667,4]
Dropping unreachable code [main.ff67c2edc2d42d6adb60.bundle.js:62726,4]
Declarations in unreachable code! [main.ff67c2edc2d42d6adb60.bundle.js:62726,4]
Dropping unreachable code [main.ff67c2edc2d42d6adb60.bundle.js:62933,4]
Declarations in unreachable code! [main.ff67c2edc2d42d6adb60.bundle.js:62933,4]
Dropping unreachable code [main.ff67c2edc2d42d6adb60.bundle.js:62989,4]
Declarations in unreachable code! [main.ff67c2edc2d42d6adb60.bundle.js:62989,4]
Dropping unreachable code [main.ff67c2edc2d42d6adb60.bundle.js:63114,4]
Declarations in unreachable code! [main.ff67c2edc2d42d6adb60.bundle.js:63114,4]
Dropping unreachable code [main.ff67c2edc2d42d6adb60.bundle.js:63236,4]
Declarations in unreachable code! [main.ff67c2edc2d42d6adb60.bundle.js:63236,4]
Dropping unreachable code [main.ff67c2edc2d42d6adb60.bundle.js:63351,4]
Declarations in unreachable code! [main.ff67c2edc2d42d6adb60.bundle.js:63351,4]
Dropping unreachable code [main.ff67c2edc2d42d6adb60.bundle.js:63391,4]
Declarations in unreachable code! [main.ff67c2edc2d42d6adb60.bundle.js:63391,4]
Dropping unreachable code [main.ff67c2edc2d42d6adb60.bundle.js:63515,4]
Declarations in unreachable code! [main.ff67c2edc2d42d6adb60.bundle.js:63515,4]
Dropping unreachable code [main.ff67c2edc2d42d6adb60.bundle.js:63805,4]
Declarations in unreachable code! [main.ff67c2edc2d42d6adb60.bundle.js:63805,4]
Non-strict equality against boolean: == true [main.ff67c2edc2d42d6adb60.bundle.js:63892,16]
Dropping unreachable code [main.ff67c2edc2d42d6adb60.bundle.js:63936,4]
Declarations in unreachable code! [main.ff67c2edc2d42d6adb60.bundle.js:63936,4]
Dropping unreachable code [main.ff67c2edc2d42d6adb60.bundle.js:64000,4]
Declarations in unreachable code! [main.ff67c2edc2d42d6adb60.bundle.js:64000,4]
Dropping unreachable code [main.ff67c2edc2d42d6adb60.bundle.js:64149,4]
Declarations in unreachable code! [main.ff67c2edc2d42d6adb60.bundle.js:64149,4]
Dropping unreachable code [main.ff67c2edc2d42d6adb60.bundle.js:64322,4]
Declarations in unreachable code! [main.ff67c2edc2d42d6adb60.bundle.js:64322,4]
Dropping unreachable code [main.ff67c2edc2d42d6adb60.bundle.js:64362,4]
Declarations in unreachable code! [main.ff67c2edc2d42d6adb60.bundle.js:64362,4]
Dropping unreachable code [main.ff67c2edc2d42d6adb60.bundle.js:64421,4]
Declarations in unreachable code! [main.ff67c2edc2d42d6adb60.bundle.js:64421,4]
Dropping unreachable code [main.ff67c2edc2d42d6adb60.bundle.js:64513,4]
Declarations in unreachable code! [main.ff67c2edc2d42d6adb60.bundle.js:64513,4]
Dropping unreachable code [main.ff67c2edc2d42d6adb60.bundle.js:64558,4]
Declarations in unreachable code! [main.ff67c2edc2d42d6adb60.bundle.js:64558,4]
Dropping unreachable code [main.ff67c2edc2d42d6adb60.bundle.js:64839,4]
Declarations in unreachable code! [main.ff67c2edc2d42d6adb60.bundle.js:64839,4]
Non-strict equality against boolean: != false [main.ff67c2edc2d42d6adb60.bundle.js:67116,47]
Dropping unused function _fetchSylesFromState [main.ff67c2edc2d42d6adb60.bundle.js:71181,9]
Side effects in initialization of unused variable strCases [main.ff67c2edc2d42d6adb60.bundle.js:72884,12]
Dropping unused variable renderMethod [main.ff67c2edc2d42d6adb60.bundle.js:75587,12]
Dropping unused variable __unused [main.ff67c2edc2d42d6adb60.bundle.js:76550,4]
Dropping unused function normalizeArray [main.ff67c2edc2d42d6adb60.bundle.js:79198,9]
Dropping unreachable code [main.ff67c2edc2d42d6adb60.bundle.js:81819,12]
Declarations in unreachable code! [main.ff67c2edc2d42d6adb60.bundle.js:81819,12]
Dropping unreachable code [main.ff67c2edc2d42d6adb60.bundle.js:81843,8]
Declarations in unreachable code! [main.ff67c2edc2d42d6adb60.bundle.js:81843,8]
Dropping unreachable code [main.ff67c2edc2d42d6adb60.bundle.js:82393,4]
Declarations in unreachable code! [main.ff67c2edc2d42d6adb60.bundle.js:82393,4]
Side effects in initialization of unused variable pathLocationStrategy [main.ff67c2edc2d42d6adb60.bundle.js:82878,4]
Side effects in initialization of unused variable hashLocationStrategy [main.ff67c2edc2d42d6adb60.bundle.js:82882,4]
Dropping side-effect-free statement [main.ff67c2edc2d42d6adb60.bundle.js:83003,0]
Side effects in initialization of unused variable __WEBPACK_IMPORTED_MODULE_5__src_dnd_component__ [main.ff67c2edc2d42d6adb60.bundle.js:82991,25]
Dropping unused variable appRoutingProviders [main.ff67c2edc2d42d6adb60.bundle.js:83328,4]
Side effects in initialization of unused variable __WEBPACK_IMPORTED_MODULE_0__environments_environment__ [main.ff67c2edc2d42d6adb60.bundle.js:83371,25]
Side effects in initialization of unused variable __WEBPACK_IMPORTED_MODULE_1__app_component__ [main.ff67c2edc2d42d6adb60.bundle.js:83372,25]
Dropping unreachable code [main.ff67c2edc2d42d6adb60.bundle.js:93857,4]
Declarations in unreachable code! [main.ff67c2edc2d42d6adb60.bundle.js:93857,4]
Condition always true [main.ff67c2edc2d42d6adb60.bundle.js:96729,4]
Dropping unreachable code [main.ff67c2edc2d42d6adb60.bundle.js:96733,7]

WARNING in polyfills.c27b87b9e504b84ce8dc.bundle.js from UglifyJs
Condition left of || always false [polyfills.c27b87b9e504b84ce8dc.bundle.js:3722,63]
Condition left of || always false [polyfills.c27b87b9e504b84ce8dc.bundle.js:3723,62]
Dropping side-effect-free statement [polyfills.c27b87b9e504b84ce8dc.bundle.js:3751,21]
Side effects in initialization of unused variable Zone [polyfills.c27b87b9e504b84ce8dc.bundle.js:3274,5]

В чем дело?

2 ответа

Предупреждение говорит вам точно, что не так, у вас есть где-то в вашем коде оператор if, который всегда будет иметь значение true, что может привести к другому коду, который никогда не будет выполнен.

Это может быть ожидаемое и желаемое поведение, но тогда ваш код должен быть написан по-другому. Измените выражение if, и предупреждение исчезнет.

Это предупреждение просто предупреждение, ваша сгенерированная папка dist сгенерирована правильно, так что ничего не ломается

Как сказал stijn26: Мы намеренно настроили webpack в angular-cli для выдачи этих предупреждений. Они представляют оптимизацию и устранение мертвого кода, который происходит в вашем коде.

У нас нет способа подавить предупреждение, но лично, на мой взгляд, мне нравится видеть эти результаты, чтобы точно знать, где мой код может быть оптимизирован в будущем.

Другие вопросы по тегам