Skip to content

outDirTemplate for customizing output directory #1069

Description

@aklinker1

Feature Request

Add a new config, outDirTemplate, that defaults to {{browser}}-mv{{manifestVersion}}. Template variables are:

Template Var Value
{{browser}} wxt.config.browser
{{manifestVersion}} wxt.config.manifestVersion
{{mode}} wxt.config.mode
{{modeSuffix}} "" for production, "-dev" for development, and "-{{mode}}" for all others
{{command}} wxt.config.command

If anyone else has other ideas for what template variables might be useful, feel free to leave a comment.

The default template should be {{browser}}-mv{{manifestVersion}} to prevent breaking changes. Will consider changing the default to {{browser}}-mv{{manifestVersion}}{{modeSuffix}} in the next major version.

Is your feature request related to a bug?

N/A

What are the alternatives?

Use a hook/module to modify the config directly:

// wxt.config.ts
import { defineConfig } from "wxt";
import path from 'node:path';

defineConfig({
  hooks: {
    ready(wxt) {
      wxt.config.outBaseDir = path.resolve("build");
      wxt.config.outDir = path.joing(wxt.config.outBaseDir, `${wxt.config.browser}-mv${wxt.config.manifestVersion}-${wxt.config.mode}`);
    },
  },
});

Additional context

Activity

  1. added
    good first issue
    on Oct 16, 2024
  2. added a commit that references this issue on Oct 17, 2024
  3. aklinker1 commented on Oct 19, 2024

    @aklinker1
    MemberAuthor

    Released in v0.19.12

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    contribution welcomegood first issue

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions