angular-cli icon indicating copy to clipboard operation
angular-cli copied to clipboard

Vite Pre-transform error

Open Enngage opened this issue 1 year ago • 6 comments

Command

serve

Is this a regression?

  • [X] Yes, this behavior used to work in the previous version

The previous version in which this bug was not present was

17.0.9

Description

Hey,

We've just upgraded from 17.0.9 to 17.1.0 and when running ng server we are getting these logs in console on each request -

9:08:17 AM [vite] Pre-transform error: Failed to load url /pdf/diet/polyfills.js (resolved id: /pdf/diet/polyfills.js). Does the file exist?
9:08:17 AM [vite] Pre-transform error: Failed to load url /pdf/diet/main.js (resolved id: /pdf/diet/main.js). Does the file exist?
9:06:33 AM [vite] Pre-transform error: Failed to load url /auth/trainer/dashboard/polyfills.js (resolved id: /auth/trainer/dashboard/polyfills.js). Does the file exist?
9:06:33 AM [vite] Pre-transform error: Failed to load url /auth/trainer/dashboard/main.js (resolved id: /auth/trainer/dashboard/main.js). Does the file exist?

As you can see the path changes based on the URL of request.

It doesn't seem to have any effect on functionality from our testing as it seems to work just fine, but why are we getting these logs? Can someone help as determine as to what might be the cause of this?

Minimal Reproduction

Exception or Error

No response

Your Environment

Angular CLI: 17.1.0
Node: 18.18.2
Package Manager: npm 9.8.1
OS: win32 x64

Angular: 17.1.0
... animations, cdk, cli, common, compiler, compiler-cli, core
... forms, localize, platform-browser, platform-browser-dynamic
... platform-server, router, ssr

Package                         Version
---------------------------------------------------------
@angular-devkit/architect       0.1701.0
@angular-devkit/build-angular   17.1.0
@angular-devkit/core            17.1.0
@angular-devkit/schematics      17.1.0
@schematics/angular             17.1.0
rxjs                            7.8.1
typescript                      5.3.3
zone.js                         0.14.3

Anything else relevant?

No response

Enngage avatar Jan 18 '24 08:01 Enngage

This seems like a bug but we'll need to look at a reproduction to find and fix the problem. Can you setup a minimal repro please?

You can read here why this is needed. A good way to make a minimal repro is to create a new app via ng new repro-app and adding the minimum possible code to show the problem. Then you can push this repository to github and link it here.

This might be related to your directory structure so its really important to get an accurate repro to diagnose this.

alan-agius4 avatar Jan 18 '24 08:01 alan-agius4

I have the same problem on 3 different projects after update

fabian-laine avatar Jan 18 '24 14:01 fabian-laine

As a workaround to prevent Vite load errors

angular.json "build": { "builder": "@angular-devkit/build-angular:application", "options": { "externalDependencies":[""],

This simply set the preTransformRequests option to false

tirtza-weinfeld avatar Jan 18 '24 16:01 tirtza-weinfeld

same issue here , just did the update 😥

telmaco avatar Jan 19 '24 10:01 telmaco

I have the same issue on 5 different projects after update

BeSaRa avatar Jan 20 '24 04:01 BeSaRa

Here is some info about this issue:

I'm using the latest MacOS 14.2.1

Node version:

node -v
v20.11.0

NG version:

Angular CLI: 17.1.0
Node: 20.11.0
Package Manager: npm 10.2.4
OS: darwin arm64

Angular: 17.1.0
... animations, cli, common, compiler, compiler-cli, core, forms
... platform-browser, platform-browser-dynamic, platform-server
... router, ssr

Package                         Version
---------------------------------------------------------
@angular-devkit/architect       0.1701.0
@angular-devkit/build-angular   17.1.0
@angular-devkit/core            17.1.0
@angular-devkit/schematics      17.1.0
@schematics/angular             17.1.0
rxjs                            7.8.1
typescript                      5.3.3
zone.js                         0.14.3

Here is a repo to reproduce: github.com/armingdev/angular-bug

command to run:

ng serve

When I hit route in my Angular 17.1.0 with SSR: http://localhost:4200/users/1

I got the error in the console:

ng serve

Initial Chunk Files | Names         |  Raw Size
polyfills.js        | polyfills     |  83.46 kB |
main.js             | main          |  22.24 kB |
styles.css          | styles        |  96 bytes |

                    | Initial Total | 105.79 kB

Lazy Chunk Files    | Names         |  Raw Size
chunk-JXFM6VDR.js   | users-routes  |   1.33 kB |

Application bundle generation complete. [2.409 seconds]
Watch mode enabled. Watching for file changes...
  ➜  Local:   http://localhost:4200/
  ➜  press h + enter to show help
8:43:20 PM [vite] Pre-transform error: Failed to load url /users/polyfills.js (resolved id: /users/polyfills.js). Does the file exist?
8:43:20 PM [vite] Pre-transform error: Failed to load url /users/main.js (resolved id: /users/main.js). Does the file exist?
id 1

I hope this helps you.

armingdev avatar Jan 20 '24 19:01 armingdev

This issue has been automatically locked due to inactivity. Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.