Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

identifier "__worker_exports__" has already been declared

Aperta
#191 1 commento 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
3/5
Tempo stimato
1-2 giorni
Idoneità per principianti
38/100
Tipo di issue
Bug
Chiarezza
Abbastanza chiara
Stato di attività
Ferma
Stack tecnologico
nuxt, typescript
Ambito
build-system

Direzione di ricerca

Riproduci la build con Nuxt 4.2.0 usando l’export minimale di fetchHeaders in app/workers/fetchHeaders.ts, quindi ispeziona l’output generato di virtual:nuxt-workers.mjs intorno alla dichiarazione duplicata di worker_exports. Confrontalo con la build del playground e considera l’issue risolta quando il worker viene compilato correttamente senza ridefinire l’identificatore.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

📚 What are you trying to do?

Whenever I try to call a function exported by the file in the Workers directory, I get a build error. It works fine in dev, but fails during the build process. Since i tried to build the playground which works just fine, im curios if if did something wrong.

its company code so its hard to give a full repro

im using Nuxt 4.2.0

🔍 What have you tried?

i tried to just have a function like the hi example from the playground

export function fetchHeaders() {
return "success";
}

ℹ️ Additional context

[nuxi 12:08:01 AM] ERROR Nuxt Build Error: [vite:worker-import-meta-url] app/workers/fetchHeaders.ts (61:6): Identifier "worker_exports" has already been declared
file: /app/workers/fetchHeaders.ts:61:6 (virtual:nuxt-workers.mjs?source=2Fapp%2Fworkers%2FfetchHeaders.ts)

59: }
60: }
61: const worker_exports = { fetchHeaders: fetchHeaders }
^
62: self.onmessage = async (e) => {
63: const { name, args, id } = e.data

at getRollupError (node_modules/rollup/dist/es/shared/parseAst.js:401:41)
at error (node_modules/rollup/dist/es/shared/parseAst.js:397:42)
at Module.error (node_modules/rollup/dist/es/shared/node-entry.js:16939:16)
at ModuleScope.addDeclaration (node_modules/rollup/dist/es/shared/node-entry.js:5540:21)
at ModuleScope.addDeclaration (node_modules/rollup/dist/es/shared/node-entry.js:15040:22)
at Identifier.declare (node_modules/rollup/dist/es/shared/node-entry.js:5425:35)
at VariableDeclarator.declareDeclarator (node_modules/rollup/dist/es/shared/node-entry.js:13042:17)
at VariableDeclaration.initialise (node_modules/rollup/dist/es/shared/node-entry.js:15397:24)
at convertNode (node_modules/rollup/dist/es/shared/node-entry.js:16337:10)
at convertNodeList (node_modules/rollup/dist/es/shared/node-entry.js:16347:38)
Lingua principale
TypeScript
Stelle
448
Fork
10
Merge medio
10h 28m
PR unite (30g)
25

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di danielroe/nuxt-workers

Tutte le issue di danielroe/nuxt-workers

Issue simili

Altre issue su TypeScript

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.