I am trying to pragmatically load the google maps using the Maps Javascript API. Though the initial version of appending the key to the script tag of the html page is working, I am trying to hide the API key in the javascript file. This is the code according to google docs: import { Loader } from "@googlemaps/js-api-loader"; let map; const additionalOptions = {}; // [START maps_programmatic_load_promise] const loader = new Loader({ apiKey: "YOUR_API_KEY", version: "weekly", ...additionalOptions, }); loader.load().then(async () => { const { Map } = await google.maps.importLibrary("maps"); map = new Map(document.getElementById("map"), { center: { lat: -34.397, lng: 150.644 }, zoom: 8, }); }); I inserted the correct API key and I got this error: Uncaught TypeError: The specifier “@googlemaps/js-api-loader” was a bare specifier, but was not remapped to anything. Relative module specifiers must start with “./”, “...
A site where you can share knowledge