If no ts-loader exists and still splice is called, the webpack configuration is faulty. That's the case when findIndex returns -1 (meaning: element not found; no index given). splice can handle negative numbers and interprets these as the n-th last element. In order to fix this we just have to check if findIndex returns a number except -1.
If no ts-loader exists and still splice is called, the webpack configuration is faulty. That's the case when findIndex returns -1 (meaning: element not found; no index given). splice can handle negative numbers and interprets these as the n-th last element. In order to fix this we just have to check if findIndex returns a number except -1.