Skip to content

worker modules import/execute with nuxt dev #17

@westhom

Description

@westhom

Not sure if this a bug or intended behavior, but it seems that worker code gets inadvertently executed during the main nuxt dev execution.

Example worker file server/workers/send-email.ts:

console.log('worker module executed') // <---- this prints out after running `nuxt dev`

export default defineWorker<SendEmailName, SendEmailData, SendEmailResult>({
  name: 'send-email',
  async processor(job) {
    // ...
  },
  options: {
    concurrency: 10
  }
})

My expectation would be, no worker code is executed in the main nuxt process to match process isolation you would see in production env. It should only execute when running via its dedicated script .output/server/workers/index.mjs or .nuxt/dev/workers/index.mjs.

Any help is much appreciated, thank you for making this Nuxt module.

Metadata

Metadata

Assignees

Labels

enhancementNew feature or requesthelp wantedExtra attention is needed

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions