rolldown / rolldown

Fast Rust bundler for JavaScript/TypeScript with Rollup-compatible API.
https://rolldown.rs
MIT License
8.79k stars 490 forks source link

[Bug]: loadFallbackPlugin should skip ids starting with `data:` #2302

Closed sapphi-red closed 1 month ago

sapphi-red commented 1 month ago

Reproduction link or steps

  1. Open https://stackblitz.com/edit/github-6jajke-dqjvmq?file=src%2Fentry.js
  2. npm run build runs automatically.
  3. An error happens

What is expected?

The loadFallbackPlugin skippes data uri ids and no error happens.

What is actually happening?

The loadFallbackPlugin tries to load data uri ids and error happens.

System Info

Stackblitz

  System:
    OS: Linux 5.0 undefined
    CPU: (8) x64 Intel(R) Core(TM) i9-9880H CPU @ 2.30GHz
    Memory: 0 Bytes / 0 Bytes
    Shell: 1.0 - /bin/jsh
  Binaries:
    Node: 18.20.3 - /usr/local/bin/node
    Yarn: 1.22.19 - /usr/local/bin/yarn
    npm: 10.2.3 - /usr/local/bin/npm
    pnpm: 8.15.6 - /usr/local/bin/pnpm
  npmPackages:
    rolldown: https://pkg.pr.new/rolldown@351d2c7 => 0.13.2

Any additional comments?

Maybe it's better to ignore any ids with protocols (e.g. data:, http:).

Faced this while trying rolldown with Vite.

IWANABETHATGUY commented 1 month ago

http: and other protocol is out of rolldown scope, even we ignore that in load-fallback, both vite and rolldown treat http://* specifier as a external dependency

IWANABETHATGUY commented 1 month ago

user should handle other protocol like uri by themself.