-
-
Notifications
You must be signed in to change notification settings - Fork 7.4k
Closed
Copy link
Labels
feat: web workershas workaroundp2-edge-caseBug, but has workaround or limited in scope (priority)Bug, but has workaround or limited in scope (priority)regressionThe issue only appears after a new releaseThe issue only appears after a new release
Description
Describe the bug
A standard integration of react-pdf with pdfjs-dist as described in their documentation works correctly with vite 7.0.6 and older but not with 7.1.0 or newer.
Given the following minimal example of react-pdf:
import { pdfjs } from 'react-pdf'
pdfjs.GlobalWorkerOptions.workerSrc = new URL(
'pdfjs-dist/build/pdf.worker.min.mjs',
import.meta.url,
).toString()
With vite 7.0.6 or older the pdf.worker.min.mjs
asset is correctly bundled and present in the dist directory:
dist/assets/pdf.worker.min--PgD6g2g.mjs 1,035.02 kB
However, with vite 7.1.0 or newer it is not.
Reproduction
https://stackblitz.com/edit/vitejs-vite-ybwgh9rm?file=src%2Fmain.js
Steps to reproduce
- Open the reproduction
- Build it with
yarn build
and observe thepdf.worker.min.mjs
file being bundled by vite - Upgrade vite to 7.1.0 or newer with
yarn add [email protected]
- Run
yarn build
again and observe the absence of thepdf.worker.min.mjs
asset.
System Info
System:
OS: Linux 6.12 Manjaro Linux
CPU: (12) x64 13th Gen Intel(R) Core(TM) i7-1365U
Memory: 21.57 GB / 31.01 GB
Container: Yes
Shell: 5.3.0 - /bin/bash
Binaries:
Node: 24.4.1 - /usr/bin/node
Yarn: 4.9.1 - /usr/bin/yarn
npm: 11.4.2 - /usr/bin/npm
npmPackages:
@vitejs/plugin-react: ^5.0.0 => 5.0.0
vite: 7.0.6 => 7.0.6
Used Package Manager
yarn
Logs
No response
Validations
- Follow our Code of Conduct
- Read the Contributing Guidelines.
- Read the docs.
- Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.
- Make sure this is a Vite issue and not a framework-specific issue. For example, if it's a Vue SFC related bug, it should likely be reported to vuejs/core instead.
- Check that this is a concrete bug. For Q&A open a GitHub Discussion or join our Discord Chat Server.
- The provided reproduction is a minimal reproducible example of the bug.
annamariaratajczak and ThuanLCSE
Metadata
Metadata
Assignees
Labels
feat: web workershas workaroundp2-edge-caseBug, but has workaround or limited in scope (priority)Bug, but has workaround or limited in scope (priority)regressionThe issue only appears after a new releaseThe issue only appears after a new release