I get a top-level-await error upon when importing BSON:
./node_modules/bson/lib/bson.mjs - 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/@angular-devkit/build-angular/src/tools/babel/webpack-loader.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)
I'm importing the library inside my component like so:
import { ObjectId } from 'bson';
Been searching everywhere but can't find an answer.
You can update your angular builder to esbuild:
Still experimental in Angular, it'll be tagged as stable with the Angular 17 release.