wxt-dev / wxt-dev/wxt

Add support for TC39 Explicit Resource Management (`using`/`await using` syntax)

Open
#1,528 7 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

upstream
Dominant language
TypeScript
Stars
10.5k
Forks
564
PR merge metrics
No merged PRs in 30d

Description

Feature Request

Please support the (await) using syntax from the TC39 Explicit Resource Management proposal. Currently, attempting to use this syntax results in the error: This experimental syntax requires enabling the parser plugin: 'explicitResourceManagement'.

Is your feature request related to a bug?

N/A

What are the alternatives?

Alternative solutions I've considered:

  1. Manually configuring Babel with the @babel/plugin-syntax-explicit-resource-management plugin, but I'm unsure how to properly integrate this with the wxt framework.
  2. Using traditional try/finally blocks or other resource management patterns, but these are more verbose and less readable than the new syntax.
Additional context

The Explicit Resource Management proposal (https://github.com/tc39/proposal-explicit-resource-management) is gaining significant adoption.

Current implementation status (from https://github.com/tc39/proposal-explicit-resource-management/issues/242):

  • TypeScript has supported it since version 5.2
  • Babel has supported it since approximately version 7.20.0
  • esbuild (which powers Vite) specifically added support in version 0.18.7
  • V8 has added support in Chrome 134
  • Mozilla's SpiderMonkey engine is actively working on implementation
  • Moddable XS implemented both sync and async versions in 2023
  • Webkit has a meta issue but has seen no movement and is currently unassigned (as of Feb 2025)

As this syntax is becoming standard across the JavaScript ecosystem, it would be valuable for wxt to support this modern language feature that improves resource management patterns.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by tracing how wxt configures Babel and Vite's parser support, using the explicitResourceManagement plugin and the esbuild version requirements described in the issue. Confirm the (await) using and await using forms parse successfully in the relevant build paths, with tests covering both syntax variants.

Written by the indexing model from the issue text.

Assessment

Tech stack
babel, javascript, typescript, vite
Domain
build-system, tooling
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.