jonataswalker/ol-contextmenu

Cannot use with parcel

cwitting opened this issue · 2 comments

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'

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';

Thanks! Providing the full path works nicely.