Azure maps not loading in D365 Ecommerce production build

Nandhini Rajavel 0 Reputation points Microsoft Employee
2024-12-18T12:34:29.45+00:00

Azure-maps-control is not loading properly in the production build of Microsoft D365 Ecommerce application. We are seeing ReferenceError: Cannot access <something> before Initialisation

Found some relevant issue in azure maps github pages. Looks like the issue is with webpack and terser minification. The map loads properly in production if minimizer is disabled . However, we are looking for a workaround as exposing source code is not advisable. https://github.com/Azure/react-azure-maps/issues/187

https://github.com/Azure/react-azure-maps/issues/193

For Ecommerce, we have this starter project on top of which our customers can have their Customizations. https://github.com/microsoft/Msdyn365.Commerce.Online . I tried implementing the suggestion in the github issues pages but none of them worked for this Ecommerce repository.

However the azure maps control works fine in production build for a React project created with Create React App (CRA). I managed to imitate the same webpack and terser configurations from the React App to our Ecommerce repository but its still failing in production build.

Note : We are using azure-maps-control version 3.5.0 I also tried using other minimizer like esbuild but got Failed to load error in the map module.

Azure Maps
Azure Maps
An Azure service that provides geospatial APIs to add maps, spatial analytics, and mobility solutions to apps.
764 questions
0 comments No comments
{count} votes

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.