Commit bc215ea
committed
fix: web build .mjs assets renamed to .js so PDF.js worker loads
The previous fix (6194e8b) only set entryFileNames + chunkFileNames,
which covers entry chunks and dynamic-import chunks but NOT assets.
PDF.js loads its worker via
new URL('pdfjs-dist/build/pdf.worker.mjs', import.meta.url)
which Vite handles as an asset import — controlled by assetFileNames,
not chunkFileNames. So the worker kept its .mjs extension and the
web host couldn't fetch it.
Adds a function-form assetFileNames that renames any .mjs asset to
.js while leaving CSS / images / fonts untouched. Verified the
worker now ships as `pdf.worker-HASH.js` in the local build output.1 parent 49e7db5 commit bc215ea
1 file changed
Lines changed: 16 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
31 | 31 | | |
32 | 32 | | |
33 | 33 | | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
34 | 37 | | |
35 | 38 | | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
36 | 52 | | |
37 | 53 | | |
38 | 54 | | |
| |||
0 commit comments