Skip to content

Bug:Cannot load resources that start with //. #15335

@zhe-he

Description

@zhe-he

Describe the bug

Adding font resources that start with // in the index.html file in the root directory causes an error in the console. The error message is [vite] Pre-transform error: Failed to load url //at.alicdn.com/t/c/font_3604131_25pwmwrknp2.js (resolved id: //at.alicdn.com/t/c/font_3604131_25pwmwrknp2.js). Does the file exist?

Reproduction

[email protected]

Steps to reproduce

  1. Create an empty project with Vite.
  2. Add <script src="//at.alicdn.com/t/c/font_3604131_25pwmwrknp2.js"></script> in the index.html file in the root directory.
  3. Run npm run dev to start the development server.
  4. Make changes and save them locally to trigger hot-reloading.
  5. Encounter an error : [vite] Pre-transform error: Failed to load url //at.alicdn.com/t/c/font_3604131_25pwmwrknp2.js (resolved id: //at.alicdn.com/t/c/font_3604131_25pwmwrknp2.js). Does the file exist?
image

System Info

System:
    OS: macOS 12.4
    CPU: (4) x64 Intel(R) Core(TM) i5-6267U CPU @ 2.90GHz
    Memory: 109.20 MB / 8.00 GB
    Shell: 5.8.1 - /bin/zsh
  Binaries:
    Node: 20.10.0 - /usr/local/bin/node
    Yarn: 1.22.19 - /usr/local/bin/yarn
    npm: 10.2.3 - /usr/local/bin/npm
    pnpm: 8.6.11 - /usr/local/bin/pnpm
  Browsers:
    Chrome: 120.0.6099.71
    Safari: 15.5

Used Package Manager

npm

Logs

No response

Validations

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions