Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

2.4K
Vistas
how to enable top level await in react.js

i have a react component that utilizes top level await , but any time i run it throws this error


Module parse failed: The top-level-await experiment is not enabled (set experiments.topLevelAwait: true to enabled it)
File was processed with these loaders:
 * ./node_modules/@pmmmwh/react-refresh-webpack-plugin/loader/index.js
 * ./node_modules/babel-loader/lib/index.js
 * ./node_modules/source-map-loader/dist/cjs.js
You may need an additional loader to handle the result of these loaders.
Error: The top-level-await experiment is not enabled (set experiments.topLevelAwait: true to enabled it)
    at C:\Users\HP\Desktop\chat-app\node_modules\webpack\lib\dependencies\HarmonyDetectionParserPlugin.js:54:11
    at Hook.eval [as call] (eval at create (C:\Users\HP\Desktop\chat-app\node_modules\tapable\lib\HookCodeFactory.js:19:10), <anonymous>:7:16)
    at Hook.CALL_DELEGATE [as _call] (C:\Users\HP\Desktop\chat-app\node_modules\tapable\lib\Hook.js:14:14)
    at JavascriptParser.walkAwaitExpression (C:\Users\HP\Desktop\chat-app\node_modules\webpack\lib\javascript\JavascriptParser.js:2314:29)
    at JavascriptParser.walkExpression (C:\Users\HP\Desktop\chat-app\node_modules\webpack\lib\javascript\JavascriptParser.js:2244:10)
    at JavascriptParser.walkVariableDeclaration (C:\Users\HP\Desktop\chat-app\node_modules\webpack\lib\javascript\JavascriptParser.js:2098:33)
    at JavascriptParser.walkStatement (C:\Users\HP\Desktop\chat-app\node_modules\webpack\lib\javascript\JavascriptParser.js:1592:10)
    at JavascriptParser.walkStatements (C:\Users\HP\Desktop\chat-app\node_modules\webpack\lib\javascript\JavascriptParser.js:1453:9)
    at JavascriptParser.parse (C:\Users\HP\Desktop\chat-app\node_modules\webpack\lib\javascript\JavascriptParser.js:3338:9)
    at C:\Users\HP\Desktop\chat-app\node_modules\webpack\lib\NormalModule.js:1082:26

i have tried creating a webpack.config.js file and adding this code

module.exports = {

    experiments: {
      topLevelAwait: true
    },
  };

but same problem

about 4 years ago · Juan Pablo Isaza
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda