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 entry for package "@maplibre/maplibre-gl-directions". The package may have incorrect main/module/exports specified in its package.json. #246

Closed
chanmathew opened this issue Jan 3, 2025 · 6 comments

Comments

@chanmathew
Copy link

Hi there,

I'm trying to install this library in a Sveltekit project, and I'm getting the following errors:

Error: Failed to resolve entry for package "@maplibre/maplibre-gl-directions". The package may have incorrect main/module/exports specified in its package.json.

Here are my relevant packages:

"svelte-maplibre": "v1.0.0-next.8",
"@sveltejs/adapter-auto": "3.2.4",
"@sveltejs/kit": "2.15.1",
"@sveltejs/vite-plugin-svelte": "^5.0.3",
"rollup-plugin-visualizer": "5.12.0",
"svelte": "5.16.0",
"svelte-check": "4.0.5",
"typescript": "5.5.4",
"vite": "6.0.3"

Not sure what the issue is exactly 🤔

@smellyshovel
Copy link
Collaborator

Hi, @chanmathew! Would be really helpful to see at least some minimal reproduction here.
Are you installing the plugin as a local package? Or straight from NPM?

@chanmathew
Copy link
Author

chanmathew commented Jan 3, 2025

Hi @smellyshovel - here you go. I'm installing as npm package:

https://stackblitz.com/edit/sveltejs-kit-template-default-6qckztah?file=src%2Froutes%2F%2Bpage.svelte

You can see as soon as I add the import from the lib it breaks the app, if you remove the import the app loads fine again.

@smellyshovel
Copy link
Collaborator

Hi @smellyshovel - here you go. I'm installing as npm package:

https://stackblitz.com/edit/sveltejs-kit-template-default-6qckztah?file=src%2Froutes%2F%2Bpage.svelte

You can see as soon as I add the import from the lib it breaks the app, if you remove the import the app loads fine again.

From what I can see, it's really an issue with plugin's settings. In short (and if I'm not mistaken), I'm using a set of package.json's fields which are compatible with earlier versions of Vite, but the newer ones need some other set of fields.

I'll try to fix that ASAP and will let you know when a new version is available. Thanks for letting me know and creating a repro!

smellyshovel added a commit that referenced this issue Jan 4, 2025
…the relevant declarations to the top of the file)
@smellyshovel

This comment has been minimized.

@smellyshovel
Copy link
Collaborator

@chanmathew in your reproduction changing the plugin version to 0.7.2 fixes the issue: https://stackblitz.com/edit/sveltejs-kit-template-default-mcyqf37v?file=package.json. Closing this one as completed.

@chanmathew
Copy link
Author

Thank you @smellyshovel ! Tested 0.7.2 locally on my end and it's loading properly now. Appreciate the quick fix!

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

2 participants