Skip to content

feat: allow ?worker&url to only get the worker url#5845

Closed
DrJume wants to merge 1 commit intovitejs:mainfrom
DrJume:main
Closed

feat: allow ?worker&url to only get the worker url#5845
DrJume wants to merge 1 commit intovitejs:mainfrom
DrJume:main

Conversation

@DrJume
Copy link

@DrJume DrJume commented Nov 26, 2021

Description

This PR allows you to import a worker with import worker from './foo?worker&url', but instead of returning a worker constructor it returns the url directly.
This is needed for using a Service Worker or a custom wrapper like Workbox.

Using import worker from './foo?url' works, but it does not transform (minify) the code or applies vite's define macros.

Additional context


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 Commit 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.

@Shinigami92 Shinigami92 added the p2-nice-to-have Not breaking anything but nice to have (priority) label Nov 26, 2021
@sapphi-red sapphi-red mentioned this pull request Apr 28, 2022
9 tasks
@sapphi-red
Copy link
Member

Thanks for the PR. Closing as it is implemented by #7914.

@sapphi-red sapphi-red closed this May 21, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

feat: web workers p2-nice-to-have Not breaking anything but nice to have (priority)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants