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
:
- In
node_modules/sidebar-v2/package.json
, add anol
dependency line - In
node_modules/ol/control.json
, add this:export {default as Sidebar} from 'sidebar-v2/js/ol5-sidebar.js';