An Azure service that provides geospatial APIs to add maps, spatial analytics, and mobility solutions to apps.
Ephirian Greetings!
I'm glad that your issue is resolved and thank you for posting your solution so that others experiencing the same thing can easily reference this!
Since the Microsoft Q&A community has a policy that the question author cannot accept their own answer, they can only accept answers by others, I'll repost your solution in case you'd like to Accept the answer.
Error Message:
While developing a WebApp using Next.js, I encountered an issue integrating Azure Maps. While running the app with npm run dev, the Azure Maps functionality works correctly. However, running with npm run start after build, the map fails to load and the following error keeps occurring. I'm not sure about the cause.
2dfcbe770-88d1-4c72-8cf3-9110d3e1007f:1 Uncaught ReferenceError: Cannot access 'Q' before initialization
Solution:
Issue may be due to Next.js using server-side routing. Even though I enabled dynamic routing with ssr set to false, and tried the below answer, I couldn't get the map to load during build. Switching back to react.js seemed to fix it.
If you have any other questions, please let me know. Thank you again for your time and patience throughout this issue.