-
Notifications
You must be signed in to change notification settings - Fork 204
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
Adds rollup configuration #48
base: master
Are you sure you want to change the base?
Conversation
…gle distribution file and adds the ability to support multiple module types.
Instead of requiring an extra dist step (that adds a node dependency where it might not already be present), can you just change the source files themselves to use UMD instead of the CommonJS module syntax they do now? AIUI, UMD is backwards compatible with CommonJS. |
@quentinmit Sorry, I don't follow. What is the draw back of require an npm package to run the build? Changing the source is much more intrusive and limiting. |
@ZacBrownBand If someone wants to use this library in their webapp, they'd need to install Node and rollup just to generate the UMD version of the source. If they're writing a webapp, it's entirely possible they don't currently have any dependency on Node at all. I think it would be a tiny diff to the source to make this be natively UMD - basically a couple lines per source file. Not much worse than what you're already doing in this pull request, no? |
Specifically, I'm suggesting the current Node-specific header and footer get replaced with the first header and footer here instead: https://github.com/umdjs/umd/blob/master/templates/returnExports.js |
@quentinmit |
@chrisveness Was there an issue with this pr? Or is it just not something you are interested in having included in this project? |
Umm – yes and no, I think. I didn't intend to close it, GitHub appears to have closed it as a result of me renaming branches. My concerns are:
As it stands, the library can be used without a build step (see example usages). As I don't use bundlers, I don't know how well it works for those using webpack or rollup – can that not be achieved with the library as it stands? (either v1/CJS or v2/ES-modules). |
Ah, I have not looked a the v2 with es modules, that is exciting. Maybe the need to have the library available as a single file bundle is something many people need. My aim was to add the option of bundling without adding the requirement to bundle, but with the release of v2 I would assume these changes are now out of date. Feel free to close, If you decide to implement some sort of bundling option (here or in npm packages) let me know if you'd want some collaboration. |
Adds rollup configuration allowing the library to be built into a single distribution file and adds the ability to support multiple module types.
I needed to make a bundled version to use in a web app and thought it could be useful for others. i added a rollup configuration and added rollup as dev dependency.
To build a
umd
module:The result will be a new javascript file
dist/geodesy.js
that contains the geodesy library.Others may update the
rollup.config.js
to change the output.Note: I added a
.gitignore
and addeddist
directory to it, as to not change whats in the repo. Ideally thedist
would exsist in the published npm package but not the repo.