Translations are extracted, not translated strings are discarded (fallback to english) and compressed.
On build time the translations are then injected by a vite plugin depending on the importing files so only used translations are imported.
Signed-off-by: Ferdinand Thiessen <opensource@fthiessen.de>
When imported in vite config it will be executed in ESM context where dynamic require of modules is not available.
But when converted to ES module it works in vite config + webpack config, but not in Cypress config.
Because our package type is `commonjs` so Typescript files are executed as CommonJS Typescript, so the Cypress config can not require "import" an ES module.
Solutions: Either set out package to `type: "module"` or as done here rewrite all require calls to dynamic import which is available on CommonJS *and* ES module.
Signed-off-by: Ferdinand Thiessen <opensource@fthiessen.de>
* Webpack emitted invalid ES module code, as it still contained `require` calls which
are undefined on ES modules
* Build time is much shorter
* Built assets are much smaller (570 kB vs 930 kB)
* Remove unneeded import
Signed-off-by: Ferdinand Thiessen <opensource@fthiessen.de>