Turbo87 / sidebar-v2

A responsive sidebar with tabs for Leaflet, OpenLayers, Google Maps, ...

Home Page:https://turbo87.github.io/sidebar-v2/examples/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Failed to resolve 'ol/control/Control' from 'node_modules/sidebar-v2/js/ol5-sidebar.js`

minorsecond opened this issue · comments

I'm trying to run npm run build build I get the error in the title, using OpenLayers 5.4.0.

I've gotten it to work before, so I know it's possible, I just can't remember what exactly needs to be done.

Here's the full error message:

@parcel/core: Failed to resolve 'ol/control/Control' from './node_modules/sidebar-v2/js/ol5-sidebar.js'

  C:\Users\rossw\WebstormProjects\PacketMap\node_modules\sidebar-v2\js\ol5-sidebar.js:2:21
    1 | // JS imports
  > 2 | import Control from 'ol/control/Control';
  >   |                     ^^^^^^^^^^^^^^^^^^^^
    3 |
    4 | export default class Sidebar extends Control {

Figured it out:

after running npm install:

  1. In node_modules/sidebar-v2/package.json, add an ol dependency line
  2. In node_modules/ol/control.json, add this: export {default as Sidebar} from 'sidebar-v2/js/ol5-sidebar.js';