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
build: Migrate to Vite 🚀 #6713
build: Migrate to Vite 🚀 #6713
Conversation
…mpatible with import.meta syntax
atible with vite
The latest updates on your projects. Learn more about Vercel for Git ↗︎
1 Ignored Deployment
|
Alright finally the PR is ready to merge!! 🚀 Huge thanks to @userquin for helping with all the queries related to |
Reverted the PR since the Developer experience seems to be deteriorated for larger files like So we will need to decouple the source code and break into smaller components post that moving to Vite will be fruitful and this might take some time and come back to Vite once we have decent page load time |
@ad1992 can you restore the branch? We can use the Vite profiler to check what's happening |
@ad1992 to run the profiler I add this new script: Go to https://www.speedscope.app/ and upload the cpu profile using the BROWSE button. Once loaded, select |
Removing eslint plugin in vite.config.ts file, why are you using eslint in dev? you can run the linter in a lint stage script, check Vite repo for example: https://github.com/vitejs/vite/blob/main/package.json#L95-L111 |
Yes we were discussing with team too and removing Eslint from dev server reduces the page load time to Thanks @userquin for sharing profiler data, will be very helpful for optimising perf / DX |
Maybe you can move from sass to postcss + postcss nested plugin, sass dart takes ~700ms You should check also UnoCSS Preset Icons, svg files to your css stylesheets no more svgr or svg in the html markup: |
* build: increase limit to 290 kB for prod bundle (excalidraw#6809) * build: Migrate to Vite 🚀 (excalidraw#6713) * init * add: vite dev build working * fix: href serving from public * feat: add ejs plugin * feat: migrated env files and ejs templating * chore: add types related to envs * chore: add vite-env types * feat: support vite pwa * chore: upgrade vite pwa * chore: pin node version to 16.18.1 * chore: preserve use of nodejs 14 * refactor: preserve REACT_APP as env prefix * chore: support esm environment variables * fix ts config * use VITE prefix and remove vite-plugin-env-compatible * introduce import-meta-loader for building pacakge as webpack isn't compatible with import.meta syntax * lint * remove import.meta.env in main.js * set debug flag to false * migrate to vitest and use jest-canvas-mock 2.4.0 so its comp atible with vite * integrate vitest-ui * fix most of teh test * snaps * Add script for testing with vite ui * fix all tests related to mocking * fix more test * fix more * fix flip.test.tsx * fix contentxmenu snaps * fix regression snaps * fix excalidraw.test.tsx and this makes all tests finally pass :) * use node 16 * specify node version * use node 16 in lint as well * fix mobile.test.tsx * use node 16 * add style-loader * upgrade to node 18 * fix lint package.json * support eslint with vite * fix lint * fix lint * fix ts * remove pwa/sw stuff * use env vars in EJS the vite way * fix lint * move remainig jest mock/spy to vite * don't cache locales * fix regex * add fonts cache * tweak * add custom service worker * upgrade vite and create font cache again * cache fonts.css and locales * tweak * use manifestTransforms for filtering locales * use assets js pattern for locales * add font.css to globIgnore so its pushed to fonts cache * create a separate chunk for locales with rollup * remove manifestTransforms and fix glob pattern for locales to filter from workbox pre-cache * push sourcemaps in production * add comments in config * lint * use node 18 * disable pwa in dev * fix * fix * increase limit of bundle * upgrade vite-pwa to latest * remove public/workbox so workbox assets are not precached * fon't club en.json and percentages.json with manual locales chunk to fix first load+offline mode * tweak regex * remove happy-dom as its not used * add comment * use any instead of ts-ignore * cleanup * remove jest-canvas-mock resolution as vite-canvas-mock was patched locking deps at 2.4.0 * use same theme color present in entry point --------- Co-authored-by: Weslley Braga <weslley@bambee.com> Co-authored-by: dwelle <luzar.david@gmail.com> * feat: adds support for stackblitz.com embeds (excalidraw#6813) feat: adds stackblitz.com embeds * revert: "build: Migrate to Vite 🚀" (excalidraw#6814) Revert "build: Migrate to Vite 🚀 (excalidraw#6713)" This reverts commit e93bbc5. * fix: prevent binding focus NaN value (excalidraw#6803) Co-authored-by: Aakansha Doshi <aakansha1216@gmail.com> * chore: typo - Collab.ts (excalidraw#6812) * fix: adding to selection via shift box-select (excalidraw#6815) * build: migrate to Vite 🚀 (excalidraw#6818) * init * add: vite dev build working * fix: href serving from public * feat: add ejs plugin * feat: migrated env files and ejs templating * chore: add types related to envs * chore: add vite-env types * feat: support vite pwa * chore: upgrade vite pwa * chore: pin node version to 16.18.1 * chore: preserve use of nodejs 14 * refactor: preserve REACT_APP as env prefix * chore: support esm environment variables * fix ts config * use VITE prefix and remove vite-plugin-env-compatible * introduce import-meta-loader for building pacakge as webpack isn't compatible with import.meta syntax * lint * remove import.meta.env in main.js * set debug flag to false * migrate to vitest and use jest-canvas-mock 2.4.0 so its comp atible with vite * integrate vitest-ui * fix most of teh test * snaps * Add script for testing with vite ui * fix all tests related to mocking * fix more test * fix more * fix flip.test.tsx * fix contentxmenu snaps * fix regression snaps * fix excalidraw.test.tsx and this makes all tests finally pass :) * use node 16 * specify node version * use node 16 in lint as well * fix mobile.test.tsx * use node 16 * add style-loader * upgrade to node 18 * fix lint package.json * support eslint with vite * fix lint * fix lint * fix ts * remove pwa/sw stuff * use env vars in EJS the vite way * fix lint * move remainig jest mock/spy to vite * don't cache locales * fix regex * add fonts cache * tweak * add custom service worker * upgrade vite and create font cache again * cache fonts.css and locales * tweak * use manifestTransforms for filtering locales * use assets js pattern for locales * add font.css to globIgnore so its pushed to fonts cache * create a separate chunk for locales with rollup * remove manifestTransforms and fix glob pattern for locales to filter from workbox pre-cache * push sourcemaps in production * add comments in config * lint * use node 18 * disable pwa in dev * fix * fix * increase limit of bundle * upgrade vite-pwa to latest * remove public/workbox so workbox assets are not precached * fon't club en.json and percentages.json with manual locales chunk to fix first load+offline mode * tweak regex * remove happy-dom as its not used * add comment * use any instead of ts-ignore * cleanup * remove jest-canvas-mock resolution as vite-canvas-mock was patched locking deps at 2.4.0 * use same theme color present in entry point * remove vite-plugin-eslint as it improves DX significantly * integrate vite-plugin-checker for ts errors * add nabla/vite-plugin-eslint * use eslint from checker only * add env variable VITE_APP_COLLAPSE_OVERLAY for collapsing the checker overlay * tweak vite checker overlay badge position * Enable eslint behind flag as its not working well with windows with non WSL * make port configurable * open the browser when server ready * enable eslint by default --------- Co-authored-by: Weslley Braga <weslley@bambee.com> Co-authored-by: dwelle <luzar.david@gmail.com> * feat: render bold lines in grid (excalidraw#6779) Co-authored-by: dwelle <luzar.david@gmail.com> * build: update to node 18 in docker (excalidraw#6822) * fix: refresh sw when browser refreshed (excalidraw#6824) * fix: refresh sw when browser refreshed * dummy test * enable immediate reload * test * fix * autoupdate * don't immediate * test * testing testing * test * test * its same * revert logs * fix types --------- * feat: add support for val.town embeds (excalidraw#6821) * feat: add support for simplePDF in Web-Embeds (excalidraw#6810) * fix: forgotten REACT_APP env variables (excalidraw#6834) * fix: add self destroying service-worker.js to migrate everyone from CRA to Vite (excalidraw#6833) * fix: add self destroying service-worker.js to migrate everyone from CRA to VITE * add comment * don't add service-worker.js to app pre-cache * fix: eye-dropper not working with app offset correctly on non-1 dPR (excalidraw#6835) * chore: update required node version to 18 (excalidraw#6837) * build(deps): bump word-wrap from 1.2.3 to 1.2.5 (excalidraw#6811) Bumps [word-wrap](https://github.com/jonschlinkert/word-wrap) from 1.2.3 to 1.2.5. - [Release notes](https://github.com/jonschlinkert/word-wrap/releases) - [Commits](jonschlinkert/word-wrap@1.2.3...1.2.5) --- updated-dependencies: - dependency-name: word-wrap dependency-type: indirect ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * test: add coverage report for PR (excalidraw#6840) * test: add coverage report for PR * gh token * fix * fix * add reporter * fix * enable v8 for coverage * no watch * test * add threshold * fix * change name so the action isn't required * change job name * rename job so it doesn't collid with test required check * remove log * build(deps): bump semver from 5.7.1 to 5.7.2 in /dev-docs (excalidraw#6757) Bumps [semver](https://github.com/npm/node-semver) from 5.7.1 to 5.7.2. - [Release notes](https://github.com/npm/node-semver/releases) - [Changelog](https://github.com/npm/node-semver/blob/v5.7.2/CHANGELOG.md) - [Commits](npm/node-semver@v5.7.1...v5.7.2) --- updated-dependencies: - dependency-name: semver dependency-type: indirect ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * fix: resizing arrow labels (excalidraw#6789) * fix arrow labels resizing - min arrow labels width based on font size - labels width and padding in % of container's width - resize labels simply multiplying by scale * remove no longer needed getContainerDims * fix arrow labels font size not updated on change font size action * fix bound arrows not updated right after resize * fix test * fix 3+ point arrow label resizing with shift * fix bound text not scaling when resizing with shift & n or s handle * fix arrow labels width not updating when moving a 2-point arrow point with shift --------- Co-authored-by: Aakansha Doshi <aakansha1216@gmail.com> * fix webpack config * updated exclude statements --------- Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: Aakansha Doshi <aakansha1216@gmail.com> Co-authored-by: Weslley Braga <weslley@bambee.com> Co-authored-by: dwelle <luzar.david@gmail.com> Co-authored-by: Tomek Sułkowski <tomek.sulkowski@gmail.com> Co-authored-by: Max Kovalenko <mxsshere@gmail.com> Co-authored-by: Arnost Pleskot <arnostpleskot@gmail.com> Co-authored-by: Achille Lacoin <achille.lacoin@gmail.com> Co-authored-by: Benjamin André-Micolon <benjamin.andremicolon@gmail.com> Co-authored-by: Ives van Hoorne <Ives.v.h@gmail.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Alex Kim <45559664+alex-kim-dev@users.noreply.github.com>
* build: increase limit to 290 kB for prod bundle (excalidraw#6809) * build: Migrate to Vite 🚀 (excalidraw#6713) * init * add: vite dev build working * fix: href serving from public * feat: add ejs plugin * feat: migrated env files and ejs templating * chore: add types related to envs * chore: add vite-env types * feat: support vite pwa * chore: upgrade vite pwa * chore: pin node version to 16.18.1 * chore: preserve use of nodejs 14 * refactor: preserve REACT_APP as env prefix * chore: support esm environment variables * fix ts config * use VITE prefix and remove vite-plugin-env-compatible * introduce import-meta-loader for building pacakge as webpack isn't compatible with import.meta syntax * lint * remove import.meta.env in main.js * set debug flag to false * migrate to vitest and use jest-canvas-mock 2.4.0 so its comp atible with vite * integrate vitest-ui * fix most of teh test * snaps * Add script for testing with vite ui * fix all tests related to mocking * fix more test * fix more * fix flip.test.tsx * fix contentxmenu snaps * fix regression snaps * fix excalidraw.test.tsx and this makes all tests finally pass :) * use node 16 * specify node version * use node 16 in lint as well * fix mobile.test.tsx * use node 16 * add style-loader * upgrade to node 18 * fix lint package.json * support eslint with vite * fix lint * fix lint * fix ts * remove pwa/sw stuff * use env vars in EJS the vite way * fix lint * move remainig jest mock/spy to vite * don't cache locales * fix regex * add fonts cache * tweak * add custom service worker * upgrade vite and create font cache again * cache fonts.css and locales * tweak * use manifestTransforms for filtering locales * use assets js pattern for locales * add font.css to globIgnore so its pushed to fonts cache * create a separate chunk for locales with rollup * remove manifestTransforms and fix glob pattern for locales to filter from workbox pre-cache * push sourcemaps in production * add comments in config * lint * use node 18 * disable pwa in dev * fix * fix * increase limit of bundle * upgrade vite-pwa to latest * remove public/workbox so workbox assets are not precached * fon't club en.json and percentages.json with manual locales chunk to fix first load+offline mode * tweak regex * remove happy-dom as its not used * add comment * use any instead of ts-ignore * cleanup * remove jest-canvas-mock resolution as vite-canvas-mock was patched locking deps at 2.4.0 * use same theme color present in entry point --------- Co-authored-by: Weslley Braga <weslley@bambee.com> Co-authored-by: dwelle <luzar.david@gmail.com> * feat: adds support for stackblitz.com embeds (excalidraw#6813) feat: adds stackblitz.com embeds * revert: "build: Migrate to Vite 🚀" (excalidraw#6814) Revert "build: Migrate to Vite 🚀 (excalidraw#6713)" This reverts commit e93bbc5. * fix: prevent binding focus NaN value (excalidraw#6803) Co-authored-by: Aakansha Doshi <aakansha1216@gmail.com> * chore: typo - Collab.ts (excalidraw#6812) * fix: adding to selection via shift box-select (excalidraw#6815) * build: migrate to Vite 🚀 (excalidraw#6818) * init * add: vite dev build working * fix: href serving from public * feat: add ejs plugin * feat: migrated env files and ejs templating * chore: add types related to envs * chore: add vite-env types * feat: support vite pwa * chore: upgrade vite pwa * chore: pin node version to 16.18.1 * chore: preserve use of nodejs 14 * refactor: preserve REACT_APP as env prefix * chore: support esm environment variables * fix ts config * use VITE prefix and remove vite-plugin-env-compatible * introduce import-meta-loader for building pacakge as webpack isn't compatible with import.meta syntax * lint * remove import.meta.env in main.js * set debug flag to false * migrate to vitest and use jest-canvas-mock 2.4.0 so its comp atible with vite * integrate vitest-ui * fix most of teh test * snaps * Add script for testing with vite ui * fix all tests related to mocking * fix more test * fix more * fix flip.test.tsx * fix contentxmenu snaps * fix regression snaps * fix excalidraw.test.tsx and this makes all tests finally pass :) * use node 16 * specify node version * use node 16 in lint as well * fix mobile.test.tsx * use node 16 * add style-loader * upgrade to node 18 * fix lint package.json * support eslint with vite * fix lint * fix lint * fix ts * remove pwa/sw stuff * use env vars in EJS the vite way * fix lint * move remainig jest mock/spy to vite * don't cache locales * fix regex * add fonts cache * tweak * add custom service worker * upgrade vite and create font cache again * cache fonts.css and locales * tweak * use manifestTransforms for filtering locales * use assets js pattern for locales * add font.css to globIgnore so its pushed to fonts cache * create a separate chunk for locales with rollup * remove manifestTransforms and fix glob pattern for locales to filter from workbox pre-cache * push sourcemaps in production * add comments in config * lint * use node 18 * disable pwa in dev * fix * fix * increase limit of bundle * upgrade vite-pwa to latest * remove public/workbox so workbox assets are not precached * fon't club en.json and percentages.json with manual locales chunk to fix first load+offline mode * tweak regex * remove happy-dom as its not used * add comment * use any instead of ts-ignore * cleanup * remove jest-canvas-mock resolution as vite-canvas-mock was patched locking deps at 2.4.0 * use same theme color present in entry point * remove vite-plugin-eslint as it improves DX significantly * integrate vite-plugin-checker for ts errors * add nabla/vite-plugin-eslint * use eslint from checker only * add env variable VITE_APP_COLLAPSE_OVERLAY for collapsing the checker overlay * tweak vite checker overlay badge position * Enable eslint behind flag as its not working well with windows with non WSL * make port configurable * open the browser when server ready * enable eslint by default --------- Co-authored-by: Weslley Braga <weslley@bambee.com> Co-authored-by: dwelle <luzar.david@gmail.com> * feat: render bold lines in grid (excalidraw#6779) Co-authored-by: dwelle <luzar.david@gmail.com> * build: update to node 18 in docker (excalidraw#6822) * fix: refresh sw when browser refreshed (excalidraw#6824) * fix: refresh sw when browser refreshed * dummy test * enable immediate reload * test * fix * autoupdate * don't immediate * test * testing testing * test * test * its same * revert logs * fix types --------- * feat: add support for val.town embeds (excalidraw#6821) * feat: add support for simplePDF in Web-Embeds (excalidraw#6810) * fix: forgotten REACT_APP env variables (excalidraw#6834) * fix: add self destroying service-worker.js to migrate everyone from CRA to Vite (excalidraw#6833) * fix: add self destroying service-worker.js to migrate everyone from CRA to VITE * add comment * don't add service-worker.js to app pre-cache * fix: eye-dropper not working with app offset correctly on non-1 dPR (excalidraw#6835) * chore: update required node version to 18 (excalidraw#6837) * build(deps): bump word-wrap from 1.2.3 to 1.2.5 (excalidraw#6811) Bumps [word-wrap](https://github.com/jonschlinkert/word-wrap) from 1.2.3 to 1.2.5. - [Release notes](https://github.com/jonschlinkert/word-wrap/releases) - [Commits](jonschlinkert/word-wrap@1.2.3...1.2.5) --- updated-dependencies: - dependency-name: word-wrap dependency-type: indirect ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * test: add coverage report for PR (excalidraw#6840) * test: add coverage report for PR * gh token * fix * fix * add reporter * fix * enable v8 for coverage * no watch * test * add threshold * fix * change name so the action isn't required * change job name * rename job so it doesn't collid with test required check * remove log * build(deps): bump semver from 5.7.1 to 5.7.2 in /dev-docs (excalidraw#6757) Bumps [semver](https://github.com/npm/node-semver) from 5.7.1 to 5.7.2. - [Release notes](https://github.com/npm/node-semver/releases) - [Changelog](https://github.com/npm/node-semver/blob/v5.7.2/CHANGELOG.md) - [Commits](npm/node-semver@v5.7.1...v5.7.2) --- updated-dependencies: - dependency-name: semver dependency-type: indirect ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * fix: resizing arrow labels (excalidraw#6789) * fix arrow labels resizing - min arrow labels width based on font size - labels width and padding in % of container's width - resize labels simply multiplying by scale * remove no longer needed getContainerDims * fix arrow labels font size not updated on change font size action * fix bound arrows not updated right after resize * fix test * fix 3+ point arrow label resizing with shift * fix bound text not scaling when resizing with shift & n or s handle * fix arrow labels width not updating when moving a 2-point arrow point with shift --------- Co-authored-by: Aakansha Doshi <aakansha1216@gmail.com> * fix webpack config * updated exclude statements --------- Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: Aakansha Doshi <aakansha1216@gmail.com> Co-authored-by: Weslley Braga <weslley@bambee.com> Co-authored-by: dwelle <luzar.david@gmail.com> Co-authored-by: Tomek Sułkowski <tomek.sulkowski@gmail.com> Co-authored-by: Max Kovalenko <mxsshere@gmail.com> Co-authored-by: Arnost Pleskot <arnostpleskot@gmail.com> Co-authored-by: Achille Lacoin <achille.lacoin@gmail.com> Co-authored-by: Benjamin André-Micolon <benjamin.andremicolon@gmail.com> Co-authored-by: Ives van Hoorne <Ives.v.h@gmail.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Alex Kim <45559664+alex-kim-dev@users.noreply.github.com>
* init * add: vite dev build working * fix: href serving from public * feat: add ejs plugin * feat: migrated env files and ejs templating * chore: add types related to envs * chore: add vite-env types * feat: support vite pwa * chore: upgrade vite pwa * chore: pin node version to 16.18.1 * chore: preserve use of nodejs 14 * refactor: preserve REACT_APP as env prefix * chore: support esm environment variables * fix ts config * use VITE prefix and remove vite-plugin-env-compatible * introduce import-meta-loader for building pacakge as webpack isn't compatible with import.meta syntax * lint * remove import.meta.env in main.js * set debug flag to false * migrate to vitest and use jest-canvas-mock 2.4.0 so its comp atible with vite * integrate vitest-ui * fix most of teh test * snaps * Add script for testing with vite ui * fix all tests related to mocking * fix more test * fix more * fix flip.test.tsx * fix contentxmenu snaps * fix regression snaps * fix excalidraw.test.tsx and this makes all tests finally pass :) * use node 16 * specify node version * use node 16 in lint as well * fix mobile.test.tsx * use node 16 * add style-loader * upgrade to node 18 * fix lint package.json * support eslint with vite * fix lint * fix lint * fix ts * remove pwa/sw stuff * use env vars in EJS the vite way * fix lint * move remainig jest mock/spy to vite * don't cache locales * fix regex * add fonts cache * tweak * add custom service worker * upgrade vite and create font cache again * cache fonts.css and locales * tweak * use manifestTransforms for filtering locales * use assets js pattern for locales * add font.css to globIgnore so its pushed to fonts cache * create a separate chunk for locales with rollup * remove manifestTransforms and fix glob pattern for locales to filter from workbox pre-cache * push sourcemaps in production * add comments in config * lint * use node 18 * disable pwa in dev * fix * fix * increase limit of bundle * upgrade vite-pwa to latest * remove public/workbox so workbox assets are not precached * fon't club en.json and percentages.json with manual locales chunk to fix first load+offline mode * tweak regex * remove happy-dom as its not used * add comment * use any instead of ts-ignore * cleanup * remove jest-canvas-mock resolution as vite-canvas-mock was patched locking deps at 2.4.0 * use same theme color present in entry point --------- Co-authored-by: Weslley Braga <weslley@bambee.com> Co-authored-by: dwelle <luzar.david@gmail.com>
Revert "build: Migrate to Vite 🚀 (excalidraw#6713)" This reverts commit e93bbc5.
for #6684
TODOS
jsdom
dependency which atleast needs 16.x and anyways its been long that we should start supporting 18.x as base minimum version and additionally Vercel refers to 14 as "died" version and needs to update to 18 else builds will be disabled post August 15.Migrating the Tests has been a tricky part as Jest doesn't ES Modules (Its still experimental) and I am trying to move to vitest instead.
Here are the blockers
Mocking the Canvas
jest-canvas-mock
but its not working well. I opened an issue hereOn further debugging I found that the error was raised from
jest-canvas-mock
of not mocking canvas element correctly, I opened an issue was raised fromjest-canvas-mock
instead and there is a PR to fix this but not merged yet.On further research, downgrading to
2.4.0
forjest-canvas-mock
helped along withresolutions
field as mentioned hereLater a patch of vitest was released with locking
jest-canvas-mock@2.4.0
so resolutions field isn't needed anymorePartial Mocking
Unfortunately partial mocking isn't working in vitest when migrating jest to vite - more info in vitest-dev/vitest#3680
But fortunately for these cases - Spying + mocking the implementation has worked out.
DOM not updating after user events eg click
This probably was related to mocking as well which is fixed automatically after mocking issue was fixed
Stats
Jest -> Vitest
So even though Vitest commits to be blazing fast but still its slower the Jest.
After migrating all the tests to Vite this is the result with threads
true
(default setting for Vitest) 👇🏻So Vitest ~8s slower than Jest, something to be aware of, here is an
open issue
regarding the slowness of Vitest when compared with Jest and Vitest team have added it in roadmap ofv1.x
as wellPWA and Service workers
Vite has a plugin
vitePWA
for PWA so we don't need to have custom code for registering and unregistering service workers and more. Mostly everything can be taken care by config.Since we have some custom stuff in https://github.com/excalidraw/excalidraw/blob/master/src/service-worker.ts which we do to optimise the cache, here are the things need to take care
Create a fonts cache with all fonts and font.css
This is working, though
font.css
I do see in fonts cache in local but in prod I am not seeing it.Cache for locales and filter it from pre-cache
This has turned out to be lot tricky and I have been trying out various approaches to fix this. I have opened an issue as well in as
navigateFallbackDenylist
doesn't exclude the url.And since it doesn't work with
src
folders I got the suggestion to try outmanifestTransforms
as mentioned here and this is finally working but only in local. In production still the locals get pre-cached and locales cache isn't relatedAll the service worker issues are now resolved - vite-pwa/vite-plugin-pwa#546 (comment)
Locales folder is now nested inside assets with rollup build
Locales cache is also created separately - however in chrome I don't see it getting updated when more langs are added but in other browser eg firefox it does and it works offline too in both so I think some caching issue with my chrome but offline behaviour is as expected so thats great
fonts.css is also now cached inside fonts cache after glob ignore.
Testing
I have tested and its working well however I would still appreciate if you can help in testing :)
Note
This PR had to be reverted post-merge as the developer experience was impacted as mentioned in #6713 (comment)
It was continued in #6818 which was finally deployed to production