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/