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

Cannot use with parcel #252

Closed
cwitting opened this issue Jan 30, 2023 · 2 comments
Closed

Cannot use with parcel #252

cwitting opened this issue Jan 30, 2023 · 2 comments

Comments

@cwitting
Copy link

When I try to start my server with npm and parcel I get the following error in the console:
ol-contextmenu.umd.cjs:8 Uncaught TypeError: Class extends value #<Object> is not a constructor or null

To reproduce:
Put the files I uploaded here mwe.zip in a folder,
then run:
npm install
npm run start
When accessing the website the error prints to the console.

I think the import 'ol-contextmenu/dist/ol-contextmenu.css' line should be import 'ol-contextmenu/ol-contextmenu.css' but that also fails with:
@parcel/core: Failed to resolve 'ol-contextmenu/ol-contextmenu.css' from './main.js'

@GastonZalba
Copy link
Contributor

Parcel doesn't support the package.exports attribute. Try including the file extensions and the entire path:

import ContextMenu from 'ol-contextmenu/dist/ol-contextmenu.js';
import 'ol-contextmenu/dist/ol-contextmenu.css';

@cwitting
Copy link
Author

cwitting commented Feb 6, 2023

Thanks! Providing the full path works nicely.

@cwitting cwitting closed this as completed Feb 6, 2023
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