Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Nuxt resolves auto-imports for a worker only in development mode #33884

@sasial-dev

Description

@sasial-dev

Environment

Operating system macOS 24.6.0
CPU Apple M1 Pro (8 cores)
Node.js version v24.12.0
nuxt/cli version 3.31.2
Package manager [email protected]
Nuxt version 4.2.2
Nitro version 2.12.9
Builder [email protected]
Config compatibilityDate, devtools, ssr
Modules -

Reproduction

GitHub repo:
https://github.com/sasial-dev/nuxt-worker-import-repro

Steps:

  1. Run nuxt dev
  2. Open dev console
  3. Something inspirational should be printed in the console
  4. Run nuxt build
  5. Run nuxt preview
  6. Open dev console and the error ReferenceError: useQuote is not defined will be sighted.

Describe the bug

I have workers setup that import composables. These work prefectly in development mode, but when building my project for the first time I get a reference error that the imports for said composables have not been resolved. There should be no behaviour change between development and build mode.

Additional context

The composables internally use no nuxt-specific code, so they can be used across the client/other threads.

Logs

Metadata

Metadata

Assignees

No one assigned

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions