js-api-loader icon indicating copy to clipboard operation
js-api-loader copied to clipboard

Remix support

Open mikecousins opened this issue 1 year ago • 6 comments

import { Loader } from "@googlemaps/js-api-loader";
         ^^^^^^
SyntaxError: Named export 'Loader' not found. The requested module '@googlemaps/js-api-loader' is a CommonJS module, which may not support all module.exports as named exports.
CommonJS modules can always be imported via the default export, for example using:

import pkg from '@googlemaps/js-api-loader';
const { Loader } = pkg;

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.

mikecousins avatar Jan 12 '24 22:01 mikecousins

If you would like to upvote the priority of this issue, please comment below or react on the original post above with :+1: so we can see what is popular when we triage.

@mikecousins Thank you for opening this issue. 🙏 Please check out these other resources that might help you get to a resolution in the meantime:

This is an automated message, feel free to ignore.

wangela avatar Jan 12 '24 22:01 wangela

@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 avatar Feb 16 '24 07:02 ahockersten

@ahockersten that's not available in certain Remix setups like Vite/SPA mode.

mikecousins avatar Feb 16 '24 20:02 mikecousins

Here's a good linter you can use to help fix the package: https://publint.dev/@googlemaps/js-api-loader

mikecousins avatar Feb 16 '24 20:02 mikecousins