geojson-path-finder icon indicating copy to clipboard operation
geojson-path-finder copied to clipboard

some way to use this library without node compiling ?

Open hayden-t opened this issue 6 years ago • 2 comments

Im a bit new to node, and it took me while to work out with your library that though not stated i (think) i had to use browserify to 'compile' the basics of your library to get it to work in the browser ?

Is there any way to use the library without this, eg just

hayden-t avatar Jul 10 '19 07:07 hayden-t

No, since it's built on modules (CommonJS), you have to bundle it to use in a browser.

Having a way to easily create a bundle is a good idea and something at least one person asked about before. I would happily accept a PR for this, but given that I don't actively work at this project, it's not likely I will add it anytime soon.

perliedman avatar Jul 22 '19 06:07 perliedman

@hayden-t probably late, but yes, there is:

<script src="https://bundle.run/[email protected]"></script>
<script>
const pathFinder = new geojsonPathFinder(geoJson);
const bestPath = pathFinder.findPath(start, end);
</script>

https://jsfiddle.net/6qugy0rm/

psociety avatar Jul 01 '21 16:07 psociety