Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(worker): support a way to name the worker #14032

Merged
merged 3 commits into from
Aug 24, 2023

Conversation

ihch
Copy link
Contributor

@ihch ihch commented Aug 6, 2023

Description

Fix #12992

I have made it possible to pass a name from the constructor in order to assign a name to the Worker.

import MyWorker from './myworker?worker';

const namedWorker = new MyWorker({ name: 'named-worker' })

image

Additional context

If the test is weird or missing, I'd be glad to know.


What is the purpose of this pull request?

  • Bug fix
  • New Feature
  • Documentation update
  • Other

Before submitting the PR, please make sure you do the following

  • Read the Contributing Guidelines.
  • Read the Pull Request Guidelines and follow the PR Title Convention.
  • Check that there isn't already a PR that solves the problem the same way to avoid creating a duplicate.
  • Provide a description in this PR that addresses what the PR is solving, or reference the issue that it solves (e.g. fixes #123).
  • Ideally, include relevant tests that fail without this PR but pass with it.

@stackblitz
Copy link

stackblitz bot commented Aug 6, 2023

Review PR in StackBlitz Codeflow Run & review this pull request in StackBlitz Codeflow.

Copy link
Member

@sapphi-red sapphi-red left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

packages/vite/src/node/plugins/worker.ts Outdated Show resolved Hide resolved
@sapphi-red sapphi-red added enhancement New feature or request p2-nice-to-have Not breaking anything but nice to have (priority) feat: web workers labels Aug 10, 2023
@ihch ihch requested a review from sapphi-red August 11, 2023 05:43
@sapphi-red sapphi-red merged commit 1f214a4 into vitejs:main Aug 24, 2023
12 checks passed
@ihch ihch deleted the feat/naming-worker branch August 25, 2023 00:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request feat: web workers p2-nice-to-have Not breaking anything but nice to have (priority)
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

Support naming worker with query suffix
4 participants