wkx
wkx copied to clipboard
Rewrite as es module
Hello, When bundling this library with rollup it throws an error because Geometry
is being declared after it's being called. This is due to circular dependencies that the current commonjs format doesn't sort out correctly. Rewriting this library as an es module would fix the problem.
(I work with @mhkeller)
I've forked the library so that we're able to use it in our app — our fork is here: https://github.com/Rich-Harris/wkx/tree/esm. The good news is that the dist/wkx.min.js
file is now less than half the size — from 63,838 bytes to 30,719. This is because Browserify adds a lot of unnecessary cruft.
All the tests still pass. Let me know if you'd like a PR!
Any update on this? I might consider making a PR if there was interest.
@Rich-Harris, I want to bundle another package (sequelize), that uses this package. While this issue is outstanding is their any magic/trickery that I can use to tell rollup to replace the require with your fork?
nevermind
I forked sequelize, referenced your wkx fork and rollup still produces a bundle that fails @
util.inherits(Point, geometry);
¯_(ツ)_/¯
+1 for solving this issue. I would like to use it in SQL-Geometry visualization in DbGate database client (written in Svelte+rollup)