9 Commits
Author SHA1 Message Date
ZauberNerd 36c1cb47c0 Implement service worker using vite-plugin-pwa 2023-07-10 00:42:54 +02:00
ZauberNerd 0701303563 Use comlink without vite-plugin-comlink
For some reason the vite-plugin-comlink doesn't seem to work in this
constellation.
I tried to reproduce in a new vite project and there it did work.
But also, the plugin does some horrible magic by replacing a
non-existant constructor `ComLinkWorker()` with the `wrap()` method
and then the only real benefit is, that we wouldn't need to write the
`expose()` method in the worker. So for that reason I'm removing the
plugin and using the comlink package directly.
2023-07-08 15:42:43 +02:00
ZauberNerd ff9f3517ec Replace Node.js's Buffer with native Typed Arrays on the client-side
Vite does not natively ship a Buffer polyfill and most of the
functionality that is required here, can be implemented natively (except
for the byte-wise compare, for that I had to write my own function).
2023-07-08 15:42:43 +02:00
ZauberNerd 4b91a1972b Replace CRA proxy config with vite's proxy config 2023-07-08 15:41:28 +02:00
ZauberNerd 6e791e1b97 Update extracted translations to remove errors in dev console
Starting the app causes several errors about missing translations to be
printed to the browsers dev console.
2023-07-08 11:32:16 +02:00
ZauberNerd ba6544ba53 Fix non-serializable error message
Using Redux Toolkit together with redux-persist requires some additional
configuration to disable the non-serializable error message:
https://redux-toolkit.js.org/usage/usage-guide#use-with-redux-persist
2023-07-08 11:24:04 +02:00
ZauberNerd d5131d167d Add service worker and make PWA installable
This commit adds a service worker to make the app installable as a PWA.
In addition to caching all generated build artifacts (css and js filse)
the service worker also caches all other static files via a
stale-while-revalidate strategy (png, ico, json, css from the public
folder).
Further, this commit adds a Notification which will be shown when the
service worker updates and clicking on the button inside it causes
the service worker to update and the page to reload.

In order to make a PWA installable we need to follow some guide lines:
https://developer.mozilla.org/en-US/docs/Web/Progressive_web_apps/Guides/Making_PWAs_installable

Fixes: #147
2023-07-07 22:15:19 +02:00
ZauberNerd a3da33d824 Replace create-react-app with vite
create-react-app seems to struggle a bit [1] and many folks are
recommending vite as an alternative, as that project is more active.
For me the reason to switch to vite is to reduce dependencies and speed
up the build process.

Replacing create-react-app with vite reduce the number of dependencies
from 1762 to 444.

I was also quite surprised, by how small the actual diff in this commit
is. From that perspective there is almost no discernible difference
between the two tools.

[1]: https://github.com/reactjs/react.dev/pull/5487#issuecomment-1409720741
2023-07-07 22:13:33 +02:00
ZauberNerd 0ca07ee805 Remove unused dependencies
Keeping the amount of dependencies small speeds up installations.
It also helps to reduce the clutter and to get a better overview of the
application.
2023-07-07 13:48:08 +02:00