Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Failed to resolve module specifier "@googlemaps/js-api-loader" for Google Maps node express server #715

Open
kyle4346 opened this issue Nov 7, 2022 · 0 comments
Assignees
Labels
triage me I really want to be triaged. type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns.

Comments

@kyle4346
Copy link

kyle4346 commented Nov 7, 2022

I'm using the google Maps javascript api and importing the module is giving an error:

Failed to resolve module specifier "@googlemaps/js-api-loader"

Here is my javascript code:

import { Loader } from "@googlemaps/js-api-loader";


const { config } = require('dotenv');
config();


const loader = new Loader({
  // Put javascript maps API key here
  apiKey: process.env.API_KEY,
  version: "weekly",
});

loader.load().then(() => {
  map = new google.maps.Map(document.getElementById("map"), {
    center: { lat: -34.397, lng: 150.644 },
    zoom: 8,
  });
});

Finally, here is my html code

<!DOCTYPE html>

<html lang="en">


  <head>
    <meta charset="utf-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <title>New App</title>
    <meta name="description" content="Google Maps Deal Finder" />
    <meta name="viewport" content="width=device-width, initial-scale=1" />
    <!-- css styling -->
    <link rel="stylesheet" href="styles/styles.css" type="text/css" />
    <!-- css styling -->
    <!-- Map Data-->
    <script src="https://polyfill.io/v3/polyfill.min.js?features=default"></script>
    <script
      type="module"
      src="javascript/index.js"
      type="application/javascript"
    ></script>
<!-- Map Data -->
  </head>
  <body>
    <div id="map"></div>
  </body>
</html>

Screenshot 2022-11-07 014746

@kyle4346 kyle4346 added triage me I really want to be triaged. type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns. labels Nov 7, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
triage me I really want to be triaged. type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns.
Projects
None yet
Development

No branches or pull requests

2 participants