-
Notifications
You must be signed in to change notification settings - Fork 44
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
simple ESM export and package.json #8
Conversation
Hey @micahscopes, thank you for the pull request! |
@znah oh of course, I ought to make sure the demos work. ESM would be the one that would run without any build step or server, since the browsers support direct ESM imports. The demos might actually work as-is with this PR, but I'll double check. But yeah, with ESM all you'd need to get started is chrome dev tools, and I believe you could keep your original workflow too, there's no requirement to use ESM as far as I know. This just makes it easier to use it quickly in a larger project. |
I'm getting CORS errors when trying to import ESM module from "file://" (w/o local webserver) |
Ah, I see, I didn't realize ESM modules can only be loaded using CORS, I thought maybe it'd be possible to load them without
Well yes, I see now, it'd be nice to preserve the ability to use the library as is. The "conventional" way of doing this would be to include a build step that generates ESM and IIFE versions (for classic script import) from ESM or CJS sources. But then that would make it messier to make releases. I think I have a workaround. It's possible to "import" ordinary JavaScript using |
f478037
to
48453b2
Compare
Okay I tried it and it seems to work while also preserving the demo functionality and avoiding a build step! |
+1 for this functionality would be nice to be able to import this |
Sure, I think I'm done with breaking API changes, will review and merge soon |
Hey, I love this library and look forward to using it for more and more stuff! For my own project I'm using it as an ESM module and installing with npm.
(resolves #5)