I am working on a project where ReactJS-frontdend and Django-backend. I use the coreapi module (npm i coreapi) to work with the frontend API. When building the application, an error pops up
Failed to minify the code from this file: ./node_modules/coreapi/lib/utils.js:7 This error points to this piece of code:
for (let transport of transports) { if (transport.schemes.includes(scheme)) { return transport } } Has anyone come across this? Any suggestions how to fix it? Rewrite this cycle as something?
Here is the complete function code:
const determineTransport = function (transports, url) { const parsedUrl = new URL(url) const scheme = parsedUrl.protocol.replace(':', '') for (let transport of transports) { if (transport.schemes.includes(scheme)) { return transport } } throw Error(`Unsupported scheme in URL: ${url}`) } Tried to change the for (... of ...) loop to Array.forEach (...), nothing has changed.
Translated all the module code through the Babel compiler in ES2015 and the problem disappeared. But in many modules, ES2016 is also used, and partly on it itself and no problems. Why are there such problems with this module?
for in[ learn.javascript.ru/… - qwabra