Skip to content

Conversation

@PendingReality
Copy link
Contributor

Improve the WASM data URL fix to use magic-string for accurate source map generation. This eliminates build warnings and ensures proper debugging support.

  • Replace string.replace() with MagicString.overwrite()
  • Return both code and source map from renderChunk
  • Uses existing magic-string dependency (via vite-plugin-dts)

Improve the WASM data URL fix to use magic-string for accurate source
map generation. This eliminates build warnings and ensures proper
debugging support.

- Replace string.replace() with MagicString.overwrite()
- Return both code and source map from renderChunk
- Uses existing magic-string dependency (via vite-plugin-dts)
@PendingReality PendingReality marked this pull request as draft December 6, 2025 01:15
- Replace match.index! with proper undefined check
- Fix CRLF to LF line endings (biome format)
@PendingReality PendingReality marked this pull request as ready for review December 6, 2025 01:55
const matches = [...code.matchAll(dataUrlPattern)];
if (matches.length === 0) return null;

const s = new MagicString(code);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no single character variable names. can you come up with something else?

@dmarcos
Copy link
Contributor

dmarcos commented Dec 7, 2025

What warnings are you referring to? I don't see any on my side when running npm run build

@mrxz
Copy link
Collaborator

mrxz commented Dec 10, 2025

What warnings are you referring to? I don't see any on my side when running `npm run build

With #231 merged the generated source map is no longer correct. Rollup detects that the plugin doesn't provide any sourcemap and logs the following warning when performing a build (twice):

[plugin fix-wasm-data-url] Sourcemap is likely to be incorrect: a plugin (fix-wasm-data-url) was used to transform files, but didn't generate a sourcemap for the transformation. Consult the plugin documentation for help

Do these warnings not show up for you when running npm run build on master?

@dmarcos
Copy link
Contributor

dmarcos commented Dec 11, 2025

Yeah I see the warning now. Overlooked. Thanks!

@dmarcos dmarcos merged commit 558a9a9 into sparkjsdev:main Dec 11, 2025
2 checks passed
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

Successfully merging this pull request may close these issues.

3 participants