-
Notifications
You must be signed in to change notification settings - Fork 18
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
Adding ES Modules to the final build #7
base: master
Are you sure you want to change the base?
Conversation
If new versions are planned, I would actually advise in favor of abandoning rollup config at all and using something like dual-publish with CJS as a more common option for module system. It would also drastically simplify the build process for you. |
Hey, so sorry I missed this. Will take a look ASAP |
Do you think publishing the TypeScript source could also solve this for you? I'm mostly outputting bundled JS to make it easier to use with a The build command fails because of uglify when I patch that rollup config change, I'll need to iterate on it. |
Most of the libs ship bundled code, that is ok. Not only it allows to use stuff, like unpkg and other CDNs right in the script tag, it also speeds up the build, as I don't need to rebuild your library from the source.
I believe it's not a common thing to ship raw As of #4, I don't see any errors, when I try to import the same file. TS doesn't throw any errors and compiles the code successfully. I guess there might be some incompatible configuration settings in |
I just published |
@g-harel I tried your beta release, but it doesn't work. I suspect it's mostly because you haven't added "module" key in |
That's embarrassing, my bad and thanks for checking. I published a patched version as |
Currently, if you have a ES bundler (Vite, Snowpack) you cannot use this library, as it uses an outdated module system (UMD).
I added the support for ES modules. It just builds 4 additional files for both versions of the lib.
Most bundlers (Vite including) will use
index.module.js
by default, but it's a convention to also add amodule
key in thepackage.json
.