Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

109
Views
['cambio hash', 'cargar'].forEach(ev => console.log(ev)); no funciona con Parcel?

Estoy siguiendo un tutorial en el que funciona la siguiente línea:

 ['hashchange', 'load'].forEach(ev => console.log(ev));

Lo escribo y me sale:

 Uncaught TypeError: Cannot read properties of undefined (reading 'forEach') at Object.eval (eval at hmrApply (runtime-378176c723eb17dd.js:297), <anonymous>:143:12) at newRequire (index.05cf099e.js:71) at hmrAcceptRun (runtime-378176c723eb17dd.js:370) at WebSocket.ws.onmessage (runtime-378176c723eb17dd.js:127)

El proyecto está utilizando Parcel: parcel index.html .
También importa core-js/stable y regenerator-runtime/runtime .

Si creo una variable que contiene la matriz y luego llamo a forEach() en esa matriz, funciona:

 const arr = ['hashchange', 'load']; arr.forEach(ev => console.log(ev));

en Object.eval (eval en hmrApply (tiempo de ejecución-378176c723eb17dd.js:297), :143:12):

 function hmrApply(bundle /*: ParcelRequire */ , asset /*: HMRAsset */ ) { var modules = bundle.modules; if (!modules) { return; } if (asset.type === 'css') { reloadCSS(); } else if (asset.type === 'js') { var deps = asset.depsByBundle[bundle.HMR_BUNDLE_ID]; if (deps) { var fn = new Function('require', 'module', 'exports', asset.output); // line 297 modules[asset.id] = [fn, deps]; } else if (bundle.parent) { hmrApply(bundle.parent, asset); } } }

en newRequire (index.05cf099e.js:71):

 function newRequire(name, jumped) { // a big function var module = (cache[name] = new newRequire.Module(name)); modules[name][0].call( // line 71 module.exports, localRequire, module, module.exports, this ); }

en hmrAcceptRun (tiempo de ejecución-378176c723eb17dd.js:370):

 function hmrAcceptRun(bundle /*: ParcelRequire */ , id /*: string */ ) { // a big function bundle(id); // line 370 cached = bundle.cache[id];

en WebSocket.ws.onmessage (tiempo de ejecución-378176c723eb17dd.js:127)

 ws.onmessage = function (event /*: {data: string, ...} */ ) { // a big function if (!acceptedAssets[id]) { hmrAcceptRun(assetsToAccept[i][0], id); // line 127 } }
about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!