thencc / algonautjs

A front end friendly Algorand utility
MIT License
10 stars 1 forks source link

transition to tsup for multi builds #12

Open spencercap opened 2 years ago

spencercap commented 2 years ago

tsup builds on top of esbuild (so it's SUPER fast) + emits type dec files + iife format

spencercap commented 2 years ago

at least, make esbuild output iife js + set the browser export to use this

building to iife, mjs, cjs: // https://medium.com/geekculture/build-a-library-with-esbuild-23235712f3c

spencercap commented 1 year ago

do we wan to use tsup? it's sightly simpler and uses esbuild under the hood. let's chat pros v cons

spencercap commented 1 year ago

@youraerials should we decide on an ncc standard. tsup or esbuild for .ts projects.

youraerials commented 1 year ago

TSUP!

spencercap commented 1 year ago

By default tsup bundles all import-ed modules but dependencies and peerDependencies in your packages.json are always excluded

https://tsup.egoist.dev/#excluding-packages


@enceladus @youraerials it would seem that the default in tsup is to NOT bundle dependencies of the pkg. i guess it assumes the pkg will be used in a project that builds it. i understand this. and instead of bundling algjs to include things like algosdk and buffer in their entirety (as we do now), should we follow suit? considering about the dux experience where the entire bundled pkg IS needed in the browser, we use jsdelivr anyway which handles that. thoughts?

spencercap commented 1 year ago

added a tsup configuration on this branch: https://github.com/thencc/algonautjs/tree/tsup-as-bundler

spencercap commented 1 year ago

perhaps this needs a new issue, but we need env / import / usage tests for algjs. there are parts for this in tests/ w the taskfile but it would help make sure this build change works as intended.

envs to cover: