-
Notifications
You must be signed in to change notification settings - Fork 13
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
feat: use tsup as a bundler #62
Conversation
Signed-off-by: Mirko Mollik <mirko.mollik@fit.fraunhofer.de>
Signed-off-by: Mirko Mollik <mirko.mollik@fit.fraunhofer.de>
Signed-off-by: Mirko Mollik <mirko.mollik@fit.fraunhofer.de>
I'll test the bundle and the browser testing :) |
@cre8 I got a quick question. When I build the package with tsup, tsup concat all the code into one js file and one d.ts file. (or one mjs and one d.mts, I guess this is ESM). Can I still get the benefits of tree shaking even if I only have one file? |
@lukasjhan Tree shaking works great with ESM, since it can analyse the exports and remove unused code before bundling. Therefore putting everything will not have a negative impact on the build size, see: https://esbuild.github.io/api/#tree-shaking tsub however has a "legacy" mode that will create a separate folder for esm and cjs and compile every file for its own: https://tsup.egoist.dev/#bundle-formats |
Good :) I'm currently resolved conflict and fixing tests on the top of your branch. |
This is really strange in here https://github.com/lukasjhan/sd-jwt-js/tree/feat/esm%2Bcjs-fix. |
Signed-off-by: Mirko Mollik <mirko.mollik@fit.fraunhofer.de>
@lukasjhan I found no way to use window.subtle function inside the jsdom, it seems that is not integrated. Right now I am building a dummy web app to test it there directly to verify to correctness in the browser |
@lukasjhan works nice in the browser with esm and the test are passing, see: https://github.com/cre8/sd-jwt-test |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@cre8 Wow I tried your test repo, It tests with the broswer.
Maybe jsdom just mock the DOM, not the whole broswer. We can try to integrate broswer later :)
I think PR is good
Since we are not using window.crypto in the actual code base, it should be fine that it is not covered by jsdom and we can still achieve 100%. |
Signed-off-by: Mirko Mollik <mirko.mollik@fit.fraunhofer.de> Co-authored-by: Mirko Mollik <mirko.mollik@fit.fraunhofer.de> Signed-off-by: Mirko Mollik <mirko.mollik@fit.fraunhofer.de>
Signed-off-by: Mirko Mollik <mirko.mollik@fit.fraunhofer.de> Co-authored-by: Mirko Mollik <mirko.mollik@fit.fraunhofer.de> Signed-off-by: Mirko Mollik <mirko.mollik@fit.fraunhofer.de>
Instead of tsc, it using https://tsup.egoist.dev/ to generate commonjs and esm