René's URL Explorer Experiment


Title: Vitest coverage issue `vite:import-analysis` error `Pre-transform error: Failed to resolve import "#/util" from "src/app/app.ts". Does the file exist?` · Issue #32891 · angular/angular-cli · GitHub

Open Graph Title: Vitest coverage issue `vite:import-analysis` error `Pre-transform error: Failed to resolve import "#/util" from "src/app/app.ts". Does the file exist?` · Issue #32891 · angular/angular-cli

X Title: Vitest coverage issue `vite:import-analysis` error `Pre-transform error: Failed to resolve import "#/util" from "src/app/app.ts". Does the file exist?` · Issue #32891 · angular/angular-cli

Description: Command test Is this a regression? Yes, this behavior used to work in the previous version The previous version in which this bug was not present was vitest@4.0.8 Description I'm not sure if this issue is an issue with Vitest, or the Ang...

Open Graph Description: Command test Is this a regression? Yes, this behavior used to work in the previous version The previous version in which this bug was not present was vitest@4.0.8 Description I'm not sure if this i...

X Description: Command test Is this a regression? Yes, this behavior used to work in the previous version The previous version in which this bug was not present was vitest@4.0.8 Description I'm not sure if th...

Opengraph URL: https://github.com/angular/angular-cli/issues/32891

X: @github

direct link

Domain: github.com


Hey, it has json ld scripts:
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Vitest coverage issue `vite:import-analysis` error `Pre-transform error: Failed to resolve import \"#/util\" from \"src/app/app.ts\". Does the file exist?`","articleBody":"### Command\n\ntest\n\n### Is this a regression?\n\n- [x] Yes, this behavior used to work in the previous version\n\n### The previous version in which this bug was not present was\n\nvitest@4.0.8\n\n### Description\n\nI'm not sure if this issue is an issue with Vitest, or the Angular CLI integration with Vitest. I put the issue here, because I have no idea how to reproduce this issue without Angular at the moment.\n\nThe issue is that when using `tsconfig.json` property `paths` and running browser tests with coverage, these `paths` will not used when Vitest tries to read coverage from source maps. The requirement seems to be that a shared chunk exists (`import './app'` in the repro steps).\n\nThis results in errors during coverage generation, but tests do not crash. The errors come from Vite's dev server pre transforming  original `.ts` files referenced in source-maps.\n\n**Requirements**\n- Using `paths` in `tsconfig.json`\n- Angular CLI + `eslint` creates a shared chunk that has the `paths` in it's sourcemap\n- Vitest with `browsers` + `coverage` + `coverageInclude`\n- Vitest `v4.1.0+`\n\n\n### Minimal Reproduction\n\n\n1. Init Angular project \u0026 install vitest coverage \u0026 browser packages\n```\nnpx @angular/cli@21.1.5 new ng21.1.5 -s -t --style css --no-ssr --ai-config none\nnpm i -E -D vitest@4.1.0 @vitest/browser-playwright@4.1.0 @vitest/coverage-v8@4.1.0 playwright\n```\n2. Add `src/app/util.ts` file\n```ts\nexport const greet = 'Hello';\n```\n3. Add a path alias to util file\n```json\n{\n  \"compilerOptions\": {\n    \"paths\": {\n      \"#/util\": [\"./src/app/util.ts\"]\n    }\n  }\n}\n```\n4. Make `App` (`app.ts`) use value from `util.ts`\n```ts\nimport { greet } from '#/util';\n// ...\nexport class App {\n  protected readonly title = signal(greet);\n}\n```\n5. Add import to `app.ts` from `app.config.ts`\n```ts\nimport './app';\n```\n6. Run tests with browser, coverage \u0026 coverage include\n```\nnpx ng test --no-watch --browsers chromium --coverage --coverage-include src/app/**/*.ts\n```\n\n### Exception or Error\n\n```text\nThere's logged errors for every file that uses the path alias, which in our project is most of them (e.g. `import { shared } from '#/core';`).\n\n\n00:02:12 [vite] (client) Pre-transform error: Failed to resolve import \"#/util\" from \"src/app/app.ts\". Does the file exist?\n  Plugin: vite:import-analysis\n  File: C:/Users/foo/repro/src/app/app.ts:3:22\n  11 |  import { Component, signal } from \"@angular/core\";\n  12 |  import { RouterOutlet } from \"@angular/router\";\n  13 |  import { greet } from \"#/util\";\n     |                         ^\n  14 |  export let App = class {\n  15 |    title = signal(greet);\n```\n\n### Your Environment\n\n```text\nI've tried with `@angular/build` + `@angular/cli` at several versions, including `21.1.x` and `21.2.x`. Downgrading `vitest` to `4.0.8` fixes the issue, but `vitest@4.1.0` and `4.1.2` both failed.\n\n----------------------------------------\n\nAngular CLI       : 21.2.5\nAngular           : 21.2.6\nNode.js           : 25.8.2 (Unsupported)\nPackage Manager   : npm 11.11.1\nOperating System  : win32 x64\n\n┌───────────────────────────┬───────────────────┬───────────────────┐\n│ Package                   │ Installed Version │ Requested Version │\n├───────────────────────────┼───────────────────┼───────────────────┤\n│ @angular/build            │ 21.2.5            │ ^21.1.5           │\n│ @angular/cli              │ 21.2.5            │ ^21.1.5           │\n│ @angular/common           │ 21.2.6            │ ^21.1.0           │\n│ @angular/compiler         │ 21.2.6            │ ^21.1.0           │\n│ @angular/compiler-cli     │ 21.2.6            │ ^21.1.0           │\n│ @angular/core             │ 21.2.6            │ ^21.1.0           │\n│ @angular/forms            │ 21.2.6            │ ^21.1.0           │\n│ @angular/platform-browser │ 21.2.6            │ ^21.1.0           │\n│ @angular/router           │ 21.2.6            │ ^21.1.0           │\n│ rxjs                      │ 7.8.2             │ ~7.8.0            │\n│ typescript                │ 5.9.3             │ ~5.9.2            │\n│ vitest                    │ 4.1.0             │ 4.1.0             │\n└───────────────────────────┴───────────────────┴───────────────────┘\n```\n\n### Anything else relevant?\n\nDoes not seem to be OS specific. The issue is on GitHub Actions on Ubuntu, and locally on Windows. ","author":{"url":"https://github.com/csvn","@type":"Person","name":"csvn"},"datePublished":"2026-03-27T23:30:31.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":3},"url":"https://github.com/32891/angular-cli/issues/32891"}

route-pattern/_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format)
route-controllervoltron_issues_fragments
route-actionissue_layout
fetch-noncev2:a72d2af2-5f77-d1aa-97b9-25b7026c68bb
current-catalog-service-hash81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114
request-id8750:1793BD:2DA7399:3FA5AF9:6A633E99
html-safe-noncee6b8c9fa1f35ad24ef2c5e1c070f9b46a916e0758454cb592d8c829c30595667
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI4NzUwOjE3OTNCRDoyREE3Mzk5OjNGQTVBRjk6NkE2MzNFOTkiLCJ2aXNpdG9yX2lkIjoiNDg4Nzk0MzI5MDI2MzEyNTY1NyIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9
visitor-hmac6064d700a3e0ca8e53abf3d4f9dcf5c7143cef5e0a74b5b9cd9cb48120e7812d
hovercard-subject-tagissue:4156467025
github-keyboard-shortcutsrepository,issues,copilot
google-site-verificationApib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I
octolytics-urlhttps://collector.github.com/github/collect
analytics-location///voltron/issues_fragments/issue_layout
fb:app_id1401488693436528
apple-itunes-appapp-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/angular/angular-cli/32891/issue_layout
twitter:imagehttps://opengraph.githubassets.com/0146dad37ce05a72473d2951e2fff4600d6b339787e01bdc17f52600f7642b2a/angular/angular-cli/issues/32891
twitter:cardsummary_large_image
og:imagehttps://opengraph.githubassets.com/0146dad37ce05a72473d2951e2fff4600d6b339787e01bdc17f52600f7642b2a/angular/angular-cli/issues/32891
og:image:altCommand test Is this a regression? Yes, this behavior used to work in the previous version The previous version in which this bug was not present was vitest@4.0.8 Description I'm not sure if this i...
og:image:width1200
og:image:height600
og:site_nameGitHub
og:typeobject
og:author:usernamecsvn
hostnamegithub.com
expected-hostnamegithub.com
None59e55daad7174ca59d63c6974d58276ccb5477442e550bebb3c035e1bef11c94
turbo-cache-controlno-preview
go-importgithub.com/angular/angular-cli git https://github.com/angular/angular-cli.git
octolytics-dimension-user_id139426
octolytics-dimension-user_loginangular
octolytics-dimension-repository_id36891867
octolytics-dimension-repository_nwoangular/angular-cli
octolytics-dimension-repository_publictrue
octolytics-dimension-repository_is_forkfalse
octolytics-dimension-repository_network_root_id36891867
octolytics-dimension-repository_network_root_nwoangular/angular-cli
turbo-body-classeslogged-out env-production page-responsive
disable-turbofalse
browser-stats-urlhttps://api.github.com/_private/browser/stats
browser-errors-urlhttps://api.github.com/_private/browser/errors
release990295d92a4cc7b63fbbd83a046217cd7d77d49c
ui-targetfull
theme-color#1e2327
color-schemelight dark

Links:

Skip to contenthttps://github.com/angular/angular-cli/issues/32891#start-of-content
https://github.com/
Sign in https://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fangular%2Fangular-cli%2Fissues%2F32891
GitHub CopilotWrite better code with AIhttps://github.com/features/copilot
GitHub Copilot appDirect agents from issue to mergehttps://github.com/features/ai/github-app
MCP RegistryNewIntegrate external toolshttps://github.com/mcp
ActionsAutomate any workflowhttps://github.com/features/actions
CodespacesInstant dev environmentshttps://github.com/features/codespaces
IssuesPlan and track workhttps://github.com/features/issues
Code ReviewManage code changeshttps://github.com/features/code-review
Code QualityEnforce quality at mergehttps://github.com/features/code-quality
GitHub Advanced SecurityFind and fix vulnerabilitieshttps://github.com/security/advanced-security
Code securitySecure your code as you buildhttps://github.com/security/advanced-security/code-security
Secret protectionStop leaks before they starthttps://github.com/security/advanced-security/secret-protection
Why GitHubhttps://github.com/why-github
Documentationhttps://docs.github.com
Bloghttps://github.blog
Changeloghttps://github.blog/changelog
Marketplacehttps://github.com/marketplace
View all featureshttps://github.com/features
Enterpriseshttps://github.com/enterprise
Small and medium teamshttps://github.com/team
Startupshttps://github.com/enterprise/startups
Nonprofitshttps://github.com/solutions/industry/nonprofits
App Modernizationhttps://github.com/solutions/use-case/app-modernization
DevSecOpshttps://github.com/solutions/use-case/devsecops
DevOpshttps://github.com/solutions/use-case/devops
CI/CDhttps://github.com/solutions/use-case/ci-cd
View all use caseshttps://github.com/solutions/use-case
Healthcarehttps://github.com/solutions/industry/healthcare
Financial serviceshttps://github.com/solutions/industry/financial-services
Manufacturinghttps://github.com/solutions/industry/manufacturing
Governmenthttps://github.com/solutions/industry/government
View all industrieshttps://github.com/solutions/industry
View all solutionshttps://github.com/solutions
AIhttps://github.com/resources/articles?topic=ai
Software Developmenthttps://github.com/resources/articles?topic=software-development
DevOpshttps://github.com/resources/articles?topic=devops
Securityhttps://github.com/resources/articles?topic=security
View all topicshttps://github.com/resources/articles
Customer storieshttps://github.com/customer-stories
Events & webinarshttps://github.com/resources/events
Ebooks & reportshttps://github.com/resources/whitepapers
Business insightshttps://github.com/solutions/executive-insights
GitHub Skillshttps://skills.github.com
Documentationhttps://docs.github.com
Customer supporthttps://support.github.com
Community forumhttps://github.com/orgs/community/discussions
Trust centerhttps://github.com/trust-center
Partnershttps://github.com/partners
View all resourceshttps://github.com/resources
GitHub SponsorsFund open source developershttps://github.com/open-source/sponsors
Security Labhttps://securitylab.github.com
Maintainer Communityhttps://maintainers.github.com
Acceleratorhttps://github.com/open-source/accelerator
GitHub Starshttps://stars.github.com
Archive Programhttps://archiveprogram.github.com
Topicshttps://github.com/topics
Trendinghttps://github.com/trending
Collectionshttps://github.com/collections
Enterprise platformAI-powered developer platformhttps://github.com/enterprise
GitHub Advanced SecurityEnterprise-grade security featureshttps://github.com/security/advanced-security
Copilot for BusinessEnterprise-grade AI featureshttps://github.com/features/copilot/copilot-business
Premium SupportEnterprise-grade 24/7 supporthttps://github.com/enterprise/premium-support
Pricinghttps://github.com/pricing
Search syntax tipshttps://docs.github.com/search-github/github-code-search/understanding-github-code-search-syntax
documentationhttps://docs.github.com/search-github/github-code-search/understanding-github-code-search-syntax
Sign in https://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fangular%2Fangular-cli%2Fissues%2F32891
Sign up https://github.com/signup?ref_cta=Sign+up&ref_loc=header+logged+out&ref_page=%2F%3Cuser-name%3E%2F%3Crepo-name%3E%2Fvoltron%2Fissues_fragments%2Fissue_layout&source=header-repo&source_repo=angular%2Fangular-cli
Reloadhttps://github.com/angular/angular-cli/issues/32891
Reloadhttps://github.com/angular/angular-cli/issues/32891
Reloadhttps://github.com/angular/angular-cli/issues/32891
Please reload this pagehttps://github.com/angular/angular-cli/issues/32891
angular https://github.com/angular
angular-clihttps://github.com/angular/angular-cli
Notifications https://github.com/login?return_to=%2Fangular%2Fangular-cli
Fork 11.9k https://github.com/login?return_to=%2Fangular%2Fangular-cli
Star 27k https://github.com/login?return_to=%2Fangular%2Fangular-cli
Code https://github.com/angular/angular-cli
Issues 269 https://github.com/angular/angular-cli/issues
Pull requests 32 https://github.com/angular/angular-cli/pulls
Actions https://github.com/angular/angular-cli/actions
Security and quality 5 https://github.com/angular/angular-cli/security
Insights https://github.com/angular/angular-cli/pulse
Code https://github.com/angular/angular-cli
Issues https://github.com/angular/angular-cli/issues
Pull requests https://github.com/angular/angular-cli/pulls
Actions https://github.com/angular/angular-cli/actions
Security and quality https://github.com/angular/angular-cli/security
Insights https://github.com/angular/angular-cli/pulse
Vitest coverage issue vite:import-analysis error Pre-transform error: Failed to resolve import "#/util" from "src/app/app.ts". Does the file exist?https://github.com/angular/angular-cli/issues/32891#top
angular/build:unit-testhttps://github.com/angular/angular-cli/issues?q=state%3Aopen%20label%3A%22angular%2Fbuild%3Aunit-test%22
area: @angular/buildhttps://github.com/angular/angular-cli/issues?q=state%3Aopen%20label%3A%22area%3A%20%40angular%2Fbuild%22
gemini-triagedLabel noting that an issue has been triaged by geminihttps://github.com/angular/angular-cli/issues?q=state%3Aopen%20label%3A%22gemini-triaged%22
https://github.com/csvn
csvnhttps://github.com/csvn
on Mar 27, 2026https://github.com/angular/angular-cli/issues/32891#issue-4156467025
angular/build:unit-testhttps://github.com/angular/angular-cli/issues?q=state%3Aopen%20label%3A%22angular%2Fbuild%3Aunit-test%22
area: @angular/buildhttps://github.com/angular/angular-cli/issues?q=state%3Aopen%20label%3A%22area%3A%20%40angular%2Fbuild%22
gemini-triagedLabel noting that an issue has been triaged by geminihttps://github.com/angular/angular-cli/issues?q=state%3Aopen%20label%3A%22gemini-triaged%22
https://github.com
Termshttps://docs.github.com/site-policy/github-terms/github-terms-of-service
Privacyhttps://docs.github.com/site-policy/privacy-policies/github-privacy-statement
Securityhttps://github.com/security
Statushttps://www.githubstatus.com/
Communityhttps://github.community/
Docshttps://docs.github.com/
Contacthttps://support.github.com?tags=dotcom-footer

Viewport: width=device-width


URLs of crawlers that visited me.