Title: Vite pre-transform error on ng serve depending on the first route loaded in 19.0.0.next-2 · Issue #28442 · angular/angular-cli · GitHub
Open Graph Title: Vite pre-transform error on ng serve depending on the first route loaded in 19.0.0.next-2 · Issue #28442 · angular/angular-cli
X Title: Vite pre-transform error on ng serve depending on the first route loaded in 19.0.0.next-2 · Issue #28442 · angular/angular-cli
Description: Command serve 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 19.0.0-next.1 Description When you run ng serve in 19.0.0-next.2, and then open http:/...
Open Graph Description: Command serve 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 19.0.0-next.1 Description When you run ng serv...
X Description: Command serve 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 19.0.0-next.1 Description When you run ng serv...
Opengraph URL: https://github.com/angular/angular-cli/issues/28442
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Vite pre-transform error on ng serve depending on the first route loaded in 19.0.0.next-2","articleBody":"### Command\r\n\r\nserve\r\n\r\n### Is this a regression?\r\n\r\n- [X] Yes, this behavior used to work in the previous version\r\n\r\n### The previous version in which this bug was not present was\r\n\r\n19.0.0-next.1\r\n\r\n### Description\r\n\r\nWhen you run `ng serve` in 19.0.0-next.2, and then open http://localhost:4200/bar/foo in the browser, you will get an error in the console:\r\n\r\n```\r\nWatch mode enabled. Watching for file changes...\r\nNOTE: Raw file sizes do not reflect development server per-request transformations.\r\n ➜ Local: http://localhost:4200/\r\n ➜ press h + enter to show help\r\n11:21:13 AM [vite] Pre-transform error: Failed to load url /bar/polyfills.js (resolved id: /bar/polyfills.js). Does the file exist?\r\n11:21:13 AM [vite] Pre-transform error: Failed to load url /bar/main.js (resolved id: /bar/main.js). Does the file exist?\r\n```\r\n\r\nIf you close the browser window, restart the dev server, and load http://localhost:4200/bar or http://localhost:4200/ in the browser, there is no error in the console.\r\n\r\nThis behavior seems to appear in 19.0.0-next-2 to 19.0.0-next-5, and doesn't happen in 19.0.0-next-1.\r\n\r\n### Minimal Reproduction\r\n\r\nI uploaded a repo with the problem here: https://github.com/Exac/ng-19-0-0-next-5-vite-pre-transform-error\r\n\r\n```bash\r\n# Don't choose SSR because the type definitions for CommonEngine seem broken in this version\r\nnpx @angular/cli@19.0.0-next.2 new check-for-pre-transform-error-19.0.0-next.2 --ssr=false\r\ncd check-for-pre-transform-error-19.0.0-next.2\r\nng g c foo\r\nng g c bar\r\n```\r\nReplace `routes` with:\r\n```typescript\r\nimport {FooComponent} from \"./foo/foo.component\";\r\n\r\nexport const routes: Routes = [\r\n {\r\n path: 'bar/:foo',\r\n component: FooComponent,\r\n },\r\n {\r\n path: 'bar',\r\n loadComponent: () => import('./bar/bar.component').then(m => m.BarComponent),\r\n },\r\n {\r\n path: '**',\r\n redirectTo: 'bar'\r\n }\r\n];\r\n```\r\n\r\nThen run the dev server and open http://localhost/bar/foo:\r\n\r\n```console\r\n$ npx concurrently \"npx wait-on tcp:4200 && curl http://localhost:4200/bar/foo\" \"npm run start\"\r\n[1] 11:53:58 AM [vite] Pre-transform error: Failed to load url /bar/polyfills.js (resolved id: /bar/polyfills.js). Does the file exist?\r\n[1] 11:53:58 AM [vite] Pre-transform error: Failed to load url /bar/main.js (resolved id: /bar/main.js). Does the file exist?\r\n```\r\n\r\n\r\n\r\n### Exception or Error\r\n\r\n```text\r\n11:21:13 AM [vite] Pre-transform error: Failed to load url /bar/polyfills.js (resolved id: /bar/polyfills.js). Does the file exist?\r\n11:21:13 AM [vite] Pre-transform error: Failed to load url /bar/main.js (resolved id: /bar/main.js). Does the file exist?\r\n```\r\n\r\n\r\n### Your Environment\r\n\r\n```text\r\n> check-for-pre-transform-error-19.0.0-next.2@0.0.0 version\r\n> ng version\r\n\r\n\r\n _ _ ____ _ ___\r\n / \\ _ __ __ _ _ _| | __ _ _ __ / ___| | |_ _|\r\n / △ \\ | '_ \\ / _` | | | | |/ _` | '__| | | | | | |\r\n / ___ \\| | | | (_| | |_| | | (_| | | | |___| |___ | |\r\n /_/ \\_\\_| |_|\\__, |\\__,_|_|\\__,_|_| \\____|_____|___|\r\n |___/\r\n\r\n\r\nAngular CLI: 19.0.0-next.6\r\nNode: 20.17.0\r\nPackage Manager: npm 10.8.2\r\nOS: linux x64\r\n\r\nAngular: 19.0.0-next.6\r\n... animations, cli, common, compiler, compiler-cli, core, forms\r\n... platform-browser, platform-browser-dynamic, platform-server\r\n... router, ssr\r\n\r\nPackage Version\r\n---------------------------------------------------------\r\n@angular-devkit/architect 0.1900.0-next.6\r\n@angular-devkit/build-angular 19.0.0-next.6\r\n@angular-devkit/core 19.0.0-next.6\r\n@angular-devkit/schematics 19.0.0-next.6\r\n@schematics/angular 19.0.0-next.6\r\nrxjs 7.8.1\r\ntypescript 5.5.4\r\nzone.js 0.15.0\r\n```\r\n\r\n\r\n### Anything else relevant?\r\n\r\nBrowser does not matter.\r\nPreviously there was a similar issue https://github.com/angular/angular-cli/issues/27907\r\nIt was fixed by @alan-agius4 in https://github.com/angular/angular-cli/pull/27910","author":{"url":"https://github.com/Exac","@type":"Person","name":"Exac"},"datePublished":"2024-09-18T18:57:42Z","url":"https://github.com/angular/angular-cli/issues/28442"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react-reconciler,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@d5750093facf |
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:8fc3c53c-a90f-78a9-ae2d-51242b725665 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | D620:3A3994:EC453E:1357E1A:6AED59F2 |
| html-safe-nonce | 7587c0f828e7083b9e664df23738e7d8a2dba0635768666dea6ed5186a872565 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJENjIwOjNBMzk5NDpFQzQ1M0U6MTM1N0UxQTo2QUVENTlGMiIsInZpc2l0b3JfaWQiOiI2NTc1MzY4NzMyMTg3OTE5MjMiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | bc6fdfac2a8bda36935f140f9b09340e7be9177a16f7e795aae614f07053a1b7 |
| hovercard-subject-tag | issue:2534461820 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/angular/angular-cli/28442/issue_layout |
| twitter:image | https://opengraph.githubassets.com/e95b3da74145b0f260bf8d6f44b9957ae18c8146247d40266ba52db5949771a0/angular/angular-cli/issues/28442 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/e95b3da74145b0f260bf8d6f44b9957ae18c8146247d40266ba52db5949771a0/angular/angular-cli/issues/28442 |
| og:image:alt | Command serve 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 19.0.0-next.1 Description When you run ng serv... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | Exac |
| hostname | github.com |
| expected-hostname | github.com |
| None | 56fb42677ae87ed3e64410323d67980aa65d0485568a7858f874e7edfc6d1c11 |
| turbo-cache-control | no-preview |
| go-import | github.com/angular/angular-cli git https://github.com/angular/angular-cli.git |
| octolytics-dimension-user_id | 139426 |
| octolytics-dimension-user_login | angular |
| octolytics-dimension-repository_id | 36891867 |
| octolytics-dimension-repository_nwo | angular/angular-cli |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 36891867 |
| octolytics-dimension-repository_network_root_nwo | angular/angular-cli |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 9c9a37e2423ed382cf39f70b5aa4b4858b40a3b0 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width