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

"Queue is not a constructor" error when bundled with WebPack #71

Closed
soryy708 opened this issue Jun 9, 2021 · 2 comments
Closed

"Queue is not a constructor" error when bundled with WebPack #71

soryy708 opened this issue Jun 9, 2021 · 2 comments

Comments

@soryy708
Copy link

soryy708 commented Jun 9, 2021

If I bundle using Webpack and I import this library, when I call findPath on an instance of PathFinder I get the following error:

Queue is not a constructor

in the dijkstra.js file

@soryy708
Copy link
Author

soryy708 commented Jun 9, 2021

I found a workaround: mourner/rbush-knn#18 (comment)

Add this to the Webpack config:

resolve: {
    alias: {
      "tinyqueue": path.join(__dirname, 'node_modules', 'tinyqueue', 'tinyqueue.js')
    }
  }

@perliedman
Copy link
Owner

Nice! I think this issue comes up a lot when mixing Webpack with CommonJS and ESM. From my understanding, it's really hard to fix on the module author side, so I think your workaround is the best I've seen so far!

I'm closing this, since it seems resolved, but can open again if there's something more that can be done on the module side!

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

No branches or pull requests

2 participants