fix: pdf.worker at root, drop vite-plugin-top-level-await package

Replace broken vite-plugin-static-copy target for pdf.worker with a
custom closeBundle plugin that copies the file directly to dist root.
Also uninstall vite-plugin-top-level-await which was removed from
vite.config.js in the previous commit.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Lotus Bot
2026-05-21 21:45:30 -04:00
parent 30c6d4736f
commit 720d18296f
3 changed files with 14 additions and 302 deletions
+12 -5
View File
@@ -17,11 +17,6 @@ const copyFiles = {
src: 'node_modules/@element-hq/element-call-embedded/dist/*',
dest: 'public/element-call',
},
{
src: 'node_modules/pdfjs-dist/build/pdf.worker.min.mjs',
dest: '',
rename: 'pdf.worker.min.js',
},
{
src: 'config.json',
dest: '',
@@ -41,6 +36,17 @@ const copyFiles = {
],
};
function copyPdfWorker() {
return {
name: 'copy-pdf-worker',
closeBundle() {
const src = path.resolve('node_modules/pdfjs-dist/build/pdf.worker.min.mjs');
const dest = path.resolve('dist/pdf.worker.min.js');
if (fs.existsSync(src)) fs.copyFileSync(src, dest);
},
};
}
function serverMatrixSdkCryptoWasm(wasmFilePath) {
return {
name: 'vite-plugin-serve-matrix-sdk-crypto-wasm',
@@ -87,6 +93,7 @@ export default defineConfig({
vanillaExtractPlugin(),
wasm(),
react(),
copyPdfWorker(),
...(process.env.SENTRY_AUTH_TOKEN
? [
sentryVitePlugin({