wxt-dev / wxt-dev/wxt

Allow custom alias paths

Open
#1,663 2 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

Feature Request

https://wxt.dev/guide/essentials/config/typescript.html#tsconfig-paths
https://wxt.dev/api/reference/wxt/interfaces/InlineConfig.html#alias

In generate-wxt-dir.ts > getTsConfigEntry, it creates paths using the following code

const paths = Object.entries(wxt.config.alias)
    .flatMap(([alias, absolutePath]) => {
      const aliasPath = getTsconfigPath(absolutePath);
      return [
        `"${alias}": ["${aliasPath}"]`,
        `"${alias}/*": ["${aliasPath}/*"]`,
      ];
    })

This doesn't work with the way our monorepo is setup, which uses something more like "${alias}/*": ["${aliasPath}/src/lib/*"]

It would be great to have more control over how the alias paths are created. In our case, it would be better to prevent adding the wildcard version so we could add our own

Is your feature request related to a bug?

N/A

What are the alternatives?

Not using the generated tsconfig.

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 in generate-wxt-dir.ts at getTsConfigEntry, then read the linked TypeScript paths and InlineConfig alias documentation. Determine how custom alias path generation should be configured, including omitting the wildcard mapping. Done means generated tsconfig paths support the requested monorepo layout without requiring users to avoid the generated tsconfig.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
build-system
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.