threedalpeng / jazzy-dalpeng

(My) Practice Helper for Jazz Guitar
https://threedalpeng.github.io/jazzy-dalpeng
1 stars 0 forks source link

Soundfonts needs to be cached and be treeshaken #1

Closed threedalpeng closed 4 months ago

threedalpeng commented 1 year ago

Problem

Now i'm using soundfont-player which provides ESM and typescript compared to midi.js. Due to the number and size of the soundfonts, it fetches them from the server at times, which is not in the plan to support all behavior including sound, offline through PWA. Currently, it can be cached by putting it in public directory which for static assets and increasing the maximum size of the file to be cached in the workbox, while the size of the application will reach 2GB. The sound I'll use is limited, and I want to get convenience in development, so I want to import the soundfonts using ESM import. I believe in Vite's tree-shaking when building.

threedalpeng commented 1 year ago

I found some docs for precaching or runtime caching in vite-pwa-plugin, so I'll try this first. I think this will work.

threedalpeng commented 4 months ago

I don't think I'm going to use this method, and I removed the dependencies.