Open mikecousins opened 10 months ago
@mikecousins Thank you for opening this issue. 🙏 Please check out these other resources that might help you get to a resolution in the meantime:
google-maps
tagThis is an automated message, feel free to ignore.
@mikecousins you can put @googlemaps/js-api-loader
in your serverDependenciesToBundle
in remix.config.js
in order to use this in Remix to get around this, see: https://remix.run/docs/en/main/file-conventions/remix-config#serverdependenciestobundle
@ahockersten that's not available in certain Remix setups like Vite/SPA mode.
Here's a good linter you can use to help fix the package: https://publint.dev/@googlemaps/js-api-loader
Until this is properly fixed, this worked for me:
import * as pkg from "@googlemaps/js-api-loader";
I'm using it all the time with exactly this import {Loader} from '...';
syntax without any problems.
An interesting point is, the error-message says The requested module '@googlemaps/js-api-loader' is a CommonJS module
, which tells me that whatever bundler you're using isn't loading the ESM-version of the package but instead (presumably) the UMD-version.
I'm not sure if there is anything we can do about this, since it has probably something to do with the configuration of the bundler.
@ahockersten that's not available in certain Remix setups like Vite/SPA mode.
Not sure about support at the time of your reply, but it's possible with Vite/SPA mode https://remix.run/docs/en/main/guides/spa-mode#cjsesm-dependency-issues
Getting this error using Remix/ESM. Any idea how to get around this? The suggested config changes for nuxt/svelte don't work in Remix.