inocan-group / vue3-google-map

A set of composable components for easy use of Google Maps in your Vue 3 projects.
https://vue3-google-map.com
MIT License
264 stars 50 forks source link

"type": "module" missing from package.json #177

Closed kylelamoreaux closed 5 months ago

kylelamoreaux commented 8 months ago

Unable to build in Vite.

`build error: file:///workspaces/ad-landing/docs/.vitepress/.temp/app.js:8 import { GoogleMap, Marker, InfoWindow } from "vue3-google-map"; ^^^^^^^^^ SyntaxError: Named export 'GoogleMap' not found. The requested module 'vue3-google-map' 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 'vue3-google-map'; const { GoogleMap, Marker, InfoWindow } = pkg;

at ModuleJob._instantiate (node:internal/modules/esm/module_job:132:21)
at async ModuleJob.run (node:internal/modules/esm/module_job:214:5)
at async ModuleLoader.import (node:internal/modules/esm/loader:329:24)
at async build (file:///workspaces/ad-landing/node_modules/vitepress/dist/node/serve-qpgewBA8.js:52991:24)`
HusamElbashir commented 5 months ago

Hey @kylelamoreaux

Which version are you using and can you provide a minimal reproduction?

abdurrahmanseyidoglu commented 5 months ago

Hey @kylelamoreaux

Which version are you using and can you provide a minimal reproduction?

I think the error happens when Vite builds for SSR

HusamElbashir commented 5 months ago

This is the same issue as #188 . The workaround for now is to add the following to your vite.config.js

ssr: {
  noExternal: ['vue3-google-map']
}

Closing this issue to keep the discussion in one place. Will hopefully release a fix in the coming days.

HusamElbashir commented 3 months ago

Fixed in v0.20.0