Please provide the environment you discovered this bug in.
Minimal reproduction repository:
https://github.com/MillerSvt/nx-wxt-vite-plugin-but-repro
Dependency versions from npm ls:
├── @analogjs/vite-plugin-angular@2.5.2
├── @angular/common@21.2.14
├── @angular/compiler-cli@21.2.14
├── @angular/compiler@21.2.14
├── @angular/core@21.2.14
├── @angular/platform-browser@21.2.14
├── @nx/workspace@22.7.5
├── @testbed/util-protocol@0.0.0 -> ./libs/testbed/util-protocol
├── nx@22.7.5
├── rxjs@7.8.2
├── testbed@ -> ./apps/testbed
├── tslib@2.8.1
├── typescript@5.9.3
├── vite@8.0.14
├── wxt@0.20.26
└── zone.js@0.16.2
The reproduction uses:
- Nx workspace
- WXT app in
apps/testbed
- workspace library in
libs/testbed/util-protocol
@analogjs/vite-plugin-angular
- TypeScript path alias from the WXT app to the workspace library source
The effective app TypeScript config has declaration generation disabled:
{
"compilerOptions": {
"declaration": false
}
}
Which area/package is the issue in?
vite-plugin-angular
Description
When a WXT app imports a path-mapped workspace library from a background.ts or content.ts entrypoint, @analogjs/vite-plugin-angular writes generated .d.ts files into the app project source directory.
The same workspace library can be imported from the popup entrypoint without reproducing the issue. The issue appears only when the import is reachable from WXT background.ts or content.ts.
The generated files are created under:
For example:
apps/testbed/libs/testbed/util-protocol/index.d.ts
This is unexpected because this is an application build, not a library build, and declaration generation is disabled in the effective app tsconfig.
Please provide the exception or error you saw
There is no build error by default. The build succeeds, but creates unexpected files inside the app project.
Steps to reproduce:
git clone https://github.com/MillerSvt/nx-wxt-vite-plugin-but-repro.git
cd nx-wxt-vite-plugin-but-repro
npm install
npm run clean
npm run build
find apps/testbed/libs -type f -maxdepth 10 2>/dev/null || true
Actual result:
apps/testbed/libs/testbed/util-protocol/index.d.ts
Expected result:
apps/testbed/libs should not be created
Other information
The workspace library is imported through a TypeScript path alias:
{
"paths": {
"@testbed/util-protocol": ["libs/testbed/util-protocol/src/index.ts"]
}
}
The WXT app imports it from an extension entrypoint, for example:
import {protocolMessage} from '@testbed/util-protocol';
console.log(protocolMessage);
Important observation:
- importing the same path-mapped workspace library only from the popup entrypoint does not reproduce the issue;
- importing it from
entrypoints/background.ts or entrypoints/content.ts reproduces the issue.
The generated files are not emitted into dist or .output; they are written back into the source app directory under apps/testbed/libs/....
I would be willing to submit a PR to fix this issue
Please provide the environment you discovered this bug in.
Minimal reproduction repository:
https://github.com/MillerSvt/nx-wxt-vite-plugin-but-repro
Dependency versions from
npm ls:The reproduction uses:
apps/testbedlibs/testbed/util-protocol@analogjs/vite-plugin-angularThe effective app TypeScript config has declaration generation disabled:
{ "compilerOptions": { "declaration": false } }Which area/package is the issue in?
vite-plugin-angular
Description
When a WXT app imports a path-mapped workspace library from a
background.tsorcontent.tsentrypoint,@analogjs/vite-plugin-angularwrites generated.d.tsfiles into the app project source directory.The same workspace library can be imported from the popup entrypoint without reproducing the issue. The issue appears only when the import is reachable from WXT
background.tsorcontent.ts.The generated files are created under:
For example:
This is unexpected because this is an application build, not a library build, and declaration generation is disabled in the effective app tsconfig.
Please provide the exception or error you saw
There is no build error by default. The build succeeds, but creates unexpected files inside the app project.
Steps to reproduce:
Actual result:
Expected result:
Other information
The workspace library is imported through a TypeScript path alias:
{ "paths": { "@testbed/util-protocol": ["libs/testbed/util-protocol/src/index.ts"] } }The WXT app imports it from an extension entrypoint, for example:
Important observation:
entrypoints/background.tsorentrypoints/content.tsreproduces the issue.The generated files are not emitted into
distor.output; they are written back into the source app directory underapps/testbed/libs/....I would be willing to submit a PR to fix this issue