-
-
Notifications
You must be signed in to change notification settings - Fork 236
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
Example usage of dist/bezier.js
#198
Comments
This library is a normal ES module, so you load it by import { Bezier } from "./somewhere/bezier.dist.js"; |
I'm having the same trouble. dist/bezier.js doesn't seem to be an ES module; it seems to be IIFE. The top level is |
This build command seemed to make it work: echo 'module.exports=require("./src/bezier.js").Bezier' | esbuild --bundle --minify --global-name=Bezier --outfile=dist/bezier.js This passes to ESBuild a CommonJS module that Note that the above method still doesn't directly expose You could also just add For my use case I've decided to either bundle bezier.js together with my application logic or directly import the |
Could you provide an example usage of
dist/bezier.js
?I was hoping to use
bezierjs
in a project that's just straight vanilla JS in the browser. My understanding is thatdist/bezier.js
was the way to do that, so my apologies if I'm mistaken about, but I had a hard time incorporatingdist/bezier.js
into my project to get it working. Regardless, it would be nice to have some example usage so people at least understand what the intended way of doing it is.For clarity, here is how I was imagining using
dist/bezier.js
:in
index.html
:in
script.js
:I eventually did get something working but it seems pretty clunky. After installing
esbuild
, I builtbez_orig.js
, unminified, and then altered it to return the appropriate class and export a global variable.Here is the command I ran to build the
bez_orig.js
:Here are the alterations I made (
diff bez_orig.js bez.js
):Note that searching
dist/bezier.js
only has three occurrences of the wordBezier
, the first two being in strings and the third being part of aPolyBezier
function. I'm not knowledgeable enough about all the build processes to say that this is necessarily an error but it does seem a bit weird to me.My apologies again if this is all part of some standard build/deploy process. I find the JS build environment foundations to be quickly changing so I tend not to keep up with what the latest best build practices are. Regardless, it would be nice to give some quick guide as to how to use the various bundled versions for people not well versed in the latest build processes for JS.
The text was updated successfully, but these errors were encountered: