harlan-zw / nuxt-webpack-optimisations

Make your Nuxt.js webpack builds faster ⚡
271 stars 8 forks source link

Fixed a bug in the webpack configuration of the esloader #30

Closed n1j0 closed 3 years ago

n1j0 commented 3 years ago

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.

harlan-zw commented 3 years ago

Awesome, thanks for the contribution @jtpfa