Facing Below build issue:
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/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)
Any please provide some solution for this ?
I got this error when exporting a module with async. Just add this to the module.exports object in webpack.config.js file.
experiments: {
topLevelAwait: true
}
You can also read up about the experiment option in Webpack documentation. https://webpack.js.org/configuration/experiments/