2👍
✅
Your attempted solution is correct, the only issue is that the let
is scoped to the IIFE scope.
Re-write your code as follows:
getProject(projectCode).then(projectData => {
// All code goes here
});
The issue original is caused by a lack of top-level await support.
Source:stackexchange.com