Skip to content
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

Broken paths with sourcemap with file:/// references #1745

Closed
haxiomic opened this issue Nov 4, 2021 · 1 comment
Closed

Broken paths with sourcemap with file:/// references #1745

haxiomic opened this issue Nov 4, 2021 · 1 comment

Comments

@haxiomic
Copy link

haxiomic commented Nov 4, 2021

I'm bundling a single js file, app.js with a sourcemap app.js.map, this sourcemap references source files by absolute paths with file:///

{
"version":3,
"file":"app.js",
"sourceRoot":"",
"sources":[
    "file:////Users/geo/Projects/example/src/DomUI.hx",

When bundling with --sourcemap

esbuild bin/app.js --bundle --outfile=bin/bundle.js --sourcemap

The sorucemap sources are included but lose the full file:/// protocol, so the browser complains about missing source files

bundle.js.map

{
  "version": 3,
  "sources": [
      "file:/Users/geo/Projects/lush-energies/src/DomUI.hx", 

If I manually replace with file:///Users/... then everything works :)

I'd guess the issue is on this line

path.Text = c.fs.Join(c.fs.Dir(file.InputFile.Source.KeyPath.Text), source)

When I get a moment out of crunch (could be a while) I'll try to get a Go environment going so I can explore this one

Using:

  • esbuild 0.7.22
  • macOS chrome
  • webserver is live-server 1.2.1 on npm
@evanw
Copy link
Owner

evanw commented Nov 4, 2021

I’m guessing that currently esbuild treats these as file paths, not URLs. In which case you could try removing the file:// at the front.

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

No branches or pull requests

2 participants