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

Named export 'GeolocateControl' not found - The requested module 'maplibre-gl' is a CommonJS module #1446

Open
69u opened this issue Mar 26, 2023 · 6 comments

Comments

@69u
Copy link

69u commented Mar 26, 2023

Hey there, I have tried to migrate to this module but unfortunately I have ran into a barrier and cannot get my map to initialize.

The error I get is as follows:
[Vue Router warn]: uncaught error during route navigation:
file://node_modules/v-mapbox/dist/v-mapbox.js:1
import { AttributionControl as E, FullscreenControl as x, GeolocateControl as A, NavigationControl as P, ScaleControl as D, Map as G, Popup as z, Marker as M } from "maplibre-gl";
^^^^^^^^^^^^^^^^
SyntaxError: Named export 'GeolocateControl' not found. The requested module 'maplibre-gl' 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 'maplibre-gl'; const { AttributionControl: E, FullscreenControl: x, GeolocateControl: A, NavigationControl: P, ScaleControl: D, Map: G, Popup: z, Marker: M } = pkg;

at ModuleJob._instantiate (node:internal/modules/esm/module_job:123:21)
at async ModuleJob.run (node:internal/modules/esm/module_job:189:5)
at async Promise.all (index 0)
at async ESMLoader.import (node:internal/modules/esm/loader:530:24)
at async ViteNodeRunner.interopedImport (file://node_modules/vite-node/dist/client.mjs:327:28)
at async ViteNodeRunner.directRequest (file://node_modules/vite-node/dist/client.mjs:227:24)
at async ViteNodeRunner.cachedRequest (file://node_modules/vite-node/dist/client.mjs:159:14)
at async ViteNodeRunner.dependencyRequest (file://node_modules/vite-node/dist/client.mjs:207:14)
at async A:\VATSAT\vatsat-cfw\components\Radar.vue:12:31
at async ViteNodeRunner.directRequest (file://node_modules/vite-node/dist/client.mjs:315:5)

If anyone could help me resolve this issue that would be highly appreciated :)

@jseekamp
Copy link

I'm having the same issue here when attempting to use v-mapbox with nuxt 3.3.2

@stenuto
Copy link

stenuto commented Apr 12, 2023

Same here with Nuxt 3.3.3

@steklopod
Copy link

Same for nuxt

@lichstam
Copy link

any solution for this?

@Artem-Schander
Copy link

@lichstam
until this has been fixed you could use an older version.
I'm using v3.1.6. Be aware; the current docs are not applicable for that version.

@uwaovo
Copy link

uwaovo commented Jun 2, 2023

nuxt 3.5.2, same here

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants