Skip to content

[Bug]: new URL in a library gives file:/// address #5093

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wfjsw opened this issue Apr 24, 2025 · 2 comments
Open

[Bug]: new URL in a library gives file:/// address #5093

wfjsw opened this issue Apr 24, 2025 · 2 comments

Comments

@wfjsw
Copy link

wfjsw commented Apr 24, 2025

Version

System:
    OS: Windows 11 10.0.26100
    CPU: (16) x64 AMD Ryzen 7 5800H with Radeon Graphics         
    Memory: 1.35 GB / 27.86 GB
  Browsers:
    Edge: Chromium (131.0.2903.99)
    Internet Explorer: 11.0.26100.1882
  npmPackages:
    @rsbuild/core: ^1.2.17 => 1.3.11 
    @rsbuild/plugin-babel: ^1.0.5 => 1.0.5 
    @rsbuild/plugin-react: ^1.1.1 => 1.3.0

Details

I have an Rslib powered library that can spawn a Web Worker: https://github.com/wudevstac/csv-js

The result bundle of that library seems to be pretty normal, where the worker file is separated and is referenced via import.meta.url:
https://github.com/wudevstac/csv-js/blob/91ca6586c0e4ea3cdf38ceeca098467d2f38db95/src/parserWorker.ts

However, once I try to call the function that spawns the worker in another Rsbuild powered React site, it turns out that the site is trying to load the worker via file:/// URL. Such URL does not exist in the original library artifact.

Image

Image

Image

Reproduce link

https://codesandbox.io/p/github/rspack-contrib/rsbuild-codesandbox-example/csb-hphzc5/draft/zealous-bush

Reproduce Steps

  1. Load the dev mode
  2. Upload a random CSV
  3. Check DevTools error log
@wfjsw wfjsw changed the title [Bug]: new URL gives file:/// address [Bug]: new URL in a library gives file:/// address Apr 24, 2025
@chenjiahan
Copy link
Member

I cannot access the CodeSandbox link, can you provide a GitHub repo instead? Thanks

Image

@wfjsw
Copy link
Author

wfjsw commented Apr 24, 2025

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants