concaveman: TypeError: Queue is not a constructor
Hello!
When running version v1.2.0 of concaveman with Webpack (in a vue-cli environment), the following error occurs:
TypeError: Queue is not a constructor
at findCandidate (index.js:95)
at concaveman (index.js:65)
In Chrome Debugger, Queue is an object which holds a transpiled ES6 module, and has __esModule and default properties.
Is this a bug in concaveman or my Webpack configuration?
Thanks!
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Reactions: 29
- Comments: 16 (2 by maintainers)
Commits related to this issue
- Fix #18 — committed to grassick/concaveman by grassick 4 years ago
Sorry for the late reaction everyone, I was holding back on this because I really don’t like the
defaulthack and planned to fully convert this package to a pure ES module withtype: "module"instead. Never got around to it but I will at some point. Released v1.2.1 with the fix.This bug seems to be breaking @turf/convex
https://github.com/Turfjs/turf/blob/master/packages/turf-convex/package.json#L58
You can get around this issue by installing tinyqueue as a dependency in your project:
And then configuring your webpack config with an
aliaswithin theresolveobject like so:Hope this helps.
@mourner who at Mapbox is responsible for merging the PR fixing this issue? This issue is a year old, and is a big bug that’s effecting a lot of users.
We manually apply @grassick’s fix for now and it works locally but this bug still breaks our build pipelines.
I had this error but with RBush, and using SvelteKit, which uses Vite. It was fixed with the same thing solution as the PR mentioned above.
I am in contact with Mapbox support about this. The GL JS team is aware but was busy with the v2 release so far.
Thanks for the suggestion @alebinson. I don’t want to introduce another 124 dependencies to our project, so we resolve the dependency via a
resolutionsblock in Yarn’s package.json. Even better of course if you control the repo yourself.We’ve caught the issue too. Lost a day of debugging.
Do you mean each client has to do it? Is it possible to fix it once and for everyone to avoid the multiplication of pain (does it really need to export both named and default)?
At least in the short-term, using
webpack-chainwe monkey patchedtinyqueuelike so: