Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Javascript Usage #52

Open
anbinhou opened this issue Mar 27, 2019 · 7 comments
Open

Javascript Usage #52

anbinhou opened this issue Mar 27, 2019 · 7 comments
Labels

Comments

@anbinhou
Copy link

Hi there,

I might be too stupid to use it in javascript. Just wondering how I should use it in my javascript/html so that I can avoid the error information of 'request is not defined' or 'Queue is not a constructor'?

Regards,

@chartinger
Copy link

For a quick fix you could use Parcel

  • checkout this repository, install dependencies
  • Install Parcel (npm install -g parcel-bundler)
  • add the line window.polylabel = polylabel; to polyline.js
  • run parcel build polylabel.js
  • use the generated dist/polylabel.js in your browser

@mstrop
Copy link

mstrop commented Jun 18, 2019

I have the same issue. Following chartinger approach, I get error

× No entries found.
at Bundler.bundle (C:\Users\marek\AppData\Roaming\npm\node_modules\parcel-bundler\src\Bundler.js:275:17)
at

when running parcel build polylabel.js

@mourner
Copy link
Member

mourner commented Jun 18, 2019

Here's a browser build that you can use from a CDN: https://bundle.run/@mapbox/[email protected]

I should update the readme about this.

@mstrop
Copy link

mstrop commented Jun 18, 2019

Here's a browser build that you can use from a CDN: https://bundle.run/@mapbox/[email protected]

I should update the readme about this.

Thanks a lot. In case anybody else has the same issue, finally Browserify ( http://browserify.org/#install ) worked for me ( you just replied quiker than I was able to post my solution ;) ).

@Thirdhuman
Copy link

@mstrop can you share your code here? I'm struggling with the same issue.

@rullymartanto
Copy link

I have load the library

<script src="https://bundle.run/@mapbox/[email protected]"></script>

import * as polylabel from 'polylabel';

still module not found

@HugoP27
Copy link

HugoP27 commented May 27, 2021

I had the same issue and fixed it by including this
polylabel.zip js file in my project and including this script tag in my html: <script type="text/javascript" src="/public/js/polylabel.js"></script>
Problem sorted

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

7 participants