Skip to content
Advertisement

How can I use leaflet-polylinedecorator with a vue app

I have a Vue 2 sample project at https://github.com/ericg-vue-questions/leaflet-test

This is a simple import issue for my code that I am not sure how to handle.

A couple of things I have tried are to modify the code to do:

JavaScript

but this results in a build error:

JavaScript

To the index.html, I also tried adding:

JavaScript

but that results in the runtime error:

JavaScript

What needs to be changed so I can import and use this leaflet extension with a vue app?

Advertisement

Answer

A solution I found was to modify main.js so it looks like:

JavaScript

Adding the require resolved the problem.

I would be interested in alternative solutions, if there are any.

User contributions licensed under: CC BY-SA
6 People found this is helpful
Advertisement