Add mode option to wxt prepare command
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 10.5k
- Forks
- 564
- PR merge metrics
- No merged PRs in 30d
Description
Feature Request
The build, zip, and dev commands all support passing the mode flag, but the prepare command does not.
In my chrome extension, I have different behavior for building the manifest in production vs development environments. In prod environments, I am fetching secrets that are not allowed to be fetched in other environments.
When my team runs prepare locally or in CI to type-check the project, the script fails because the buildManifest function is run in production mode and attempts to fetch secrets that are not allowed.
Allowing devs to pass --mode to prepare would align it with the behavior of the other scripts that are needed for local development and provide a clean solution to this problem.
Is your feature request related to a bug?
No
What are the alternatives?
As a workaround, I am setting NODE_ENV to development and then checking if the mode is production and the NODE_ENV is development to know that we are running in the prepare script.
The alternative solution for the wxt project is to skip building the manifest when running prepare.
Additional context
The documentation could be a little bit clearer on this:
By default, --mode is development for the dev command and production for all other commands (build, zip, etc).
The "etc." here implies that there are commands other than dev, build, and zip which support the --mode flag, but actually only those three support it and the others are always production.
https://wxt.dev/guide/essentials/config/build-mode.html#build-modes
Also, thank you for all the work on this project. It has been a joy to work with wxt.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start at the prepare command implementation and compare how the build, zip, and dev commands parse and apply the mode flag. The work is done when prepare accepts --mode consistently and the build-mode documentation accurately lists which commands support it.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- build-system, cli, tooling
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100