Skip to content

Vite Pre-transform error #26897

Closed
Closed

Description

@Enngage

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

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

Activity

  1. alan-agius4 commented on Jan 18, 2024

    @alan-agius4
    Collaborator

    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.

  2. added
    needs: repro steps
    on Jan 18, 2024
  3. fabian-laine commented on Jan 18, 2024

    @fabian-laine

    I have the same problem on 3 different projects after update

  4. tirtza-weinfeld commented on Jan 18, 2024

    @tirtza-weinfeld

    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

  5. telmaco commented on Jan 19, 2024

    @telmaco

    same issue here , just did the update 😥

  6. BeSaRa commented on Jan 20, 2024

    @BeSaRa

    I have the same issue on 5 different projects after update

  7. armingdev commented on Jan 20, 2024

    @armingdev

    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.

  8. self-assigned this
    on Jan 22, 2024
  9. added 2 commits that reference this issue on Jan 22, 2024
    b149c61
    54da51a
  10. added 2 commits that reference this issue on Jan 22, 2024
    0b0df5a
    412fe6e
  11. angular-automatic-lock-bot commented on Feb 22, 2024

    @angular-automatic-lock-bot

    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.

  12. locked and limited conversation to collaborators on Feb 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions