Skip to content

fix: bundle classic workers by default (fix #8466)#11874

Open
jonathantneal wants to merge 5 commits intovitejs:mainfrom
jonathantneal:jn.fix-workers-in-dev
Open

fix: bundle classic workers by default (fix #8466)#11874
jonathantneal wants to merge 5 commits intovitejs:mainfrom
jonathantneal:jn.fix-workers-in-dev

Conversation

@jonathantneal
Copy link

@jonathantneal jonathantneal commented Feb 1, 2023

Description

In dev mode, classic workers are not transpiling as they do in build. This causes workers with imports to fail exclusively in development while working successfully in production.

Resolves #8466

P.S. Long time user, first time contributor. I am willing and happy to fix everything wrong with my PR, and I will appreciate any guidance on how to do so.

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

@jonathantneal jonathantneal changed the title fix: bundle classic workers by default fix: bundle classic workers by default (fix #8466) Feb 1, 2023
@patak-cat
Copy link
Member

@jonathantneal pushed a commit to fix the syntax error that was causing the CI to fail.
It could have also been fixed by:

result.code = injectEnv + ';' + result.code

The issue was that that result.code started with a ( so the extra ; is needed.

Could you give more context for this PR? Adding a test case that fails without this PR for example.
And would you explain how this PR resolves #8466? IIUC, @okikio is asking for a build time option to generate both types of workers and decide which one to use depending on the platform in it. And this is a dev-only fix.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat: support generating multiple difference versions of worker files e.g. iife and esm

3 participants