Server bundles embed source maps already saved as .map files
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 44.8k
- Forks
- 5.2k
- Avg merge
- 3d 12h
- Merged PRs (30d)
- 25
Description
Expected behavior: Reference the external `.map` file instead of embedding a duplicate.
[Commit 948d9628f8c9](https://github.com/meteor/meteor/commit/948d9628f8c99c08e90c3935745ea7753b53e8f9) added embedding in October 2017. The [stated reason](https://github.com/meteor/meteor/issues/9166#issuecomment-335525898) was to avoid loading map files from disk on Windows.
Chromium [fixed Windows path handling in January 2018](https://chromium.googlesource.com/chromium/src/+/2e6a86dc0fe38ca58339cd3570df3292d7497a8d). Node [closed the linked issue as fixed in February 2019](https://github.com/nodejs/node/issues/10838#issuecomment-461781129).
There is no need to embed source maps anymore. For example of the impact in https://github.com/wekan/wekan:
```text
app.js: 134.05 MiB
Embedded map URL: 88.55 MiB
```
The embedded map accounts for 66% of the file.
### Reproduction
Meteor writes a `.map` file, then embeds the same map as base64 in the JavaScript, including production builds.
```js
loadItem.sourceMap = await builder.writeToGeneratedFilename(
item.targetPath + ".map",
{ data: sourceMapBuffer }
);
const sourceMappingURL =
"data:application/json;charset=utf8;base64," +
sourceMapBuffer.toString("base64");
sourceBuffer = addSourceMappingURL(
item.source,
sourceMappingURL,
item.targetPath,
);
```
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start at the source-map writing and addSourceMappingURL entry points shown in the issue, and trace how the generated JavaScript and .map paths are produced. Build a production bundle to confirm the JavaScript references the external .map file rather than containing a base64 data URL, while preserving the generated map file.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- build-system
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 70/100