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

Some sourcemap notes #4015

Open
bep opened this issue Dec 20, 2024 · 1 comment
Open

Some sourcemap notes #4015

bep opened this issue Dec 20, 2024 · 1 comment
Labels

Comments

@bep
Copy link

bep commented Dec 20, 2024

I revised and extended the esbuild integration in hugo with code splitting (yes, I know about the ordering issue(s)), and had some issues getting source maps working correctly across platforms.

Note that using the Go API it was fairly simple to rewrite the source maps sources field, so this isn't a blocker for me, but I thought I make an issue jotting down my experiences.

Two issues:

  1. The only way I found to get the sources filenames correct was to use the outDir setting and then do filepath.Join(outdir, pathFromSources). Also see this comment: Source map sources relative to temporary output path #2218 (comment)
  2. Filenames on form /foo/bar.js or c:\\foo\\bar.js in sources works great in Chrome on MacOs, but fails on Windows. Converting it into a URL (file:) makes it work for both.
@evanw evanw added the breaking label Dec 20, 2024
@evanw
Copy link
Owner

evanw commented Dec 20, 2024

Yes, there are several open problems with source maps. Here are some similar ones to what you are bringing up:

The underlying root cause is esbuild treating these strings as file system paths instead of as URLs. However, changing this will break tools that operate on esbuild's output and that expect file system paths, so I'll need to fix these in a breaking change release.

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

No branches or pull requests

2 participants