Create a bundle for browsers that includes the Wasm code?
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 35/100
- Issue type
- Feature
- Clarity
- Mostly clear
- Activity status
- Stale
- Tech stack
- javascript, wasm, webpack
- Domain
- build-system, tooling
Research direction
Start with the proposed webpack.config.js and the browser setup using lib/mappings.wasm, then inspect the TypeScript declaration file for SourceMapConsumer.initialize(). Define the browser bundle and Node.js behavior, and update the declarations if appropriate; done means consumers can use the Wasm implementation without exposing its setup details.
Written by the indexing model from the issue text.
Description
Suggestion: source-map would be easier to use if it completely hid the fact that it internally uses Wasm.
- For browsers, you can do that by distributing a bundle, as shown below.
- For Node.js, this should be even simpler.
webpack.config.js:
const path = require('path');
module.exports = {
// ···
module: {
rules: [
{
test: /\.wasm$/,
type: 'javascript/auto',
loader: 'arraybuffer-loader', // installed via npm
},
],
},
};
Setup code (when used outside the library):
import arrayBuffer from 'source-map/lib/mappings.wasm';
SourceMapConsumer.initialize({
'lib/mappings.wasm': arrayBuffer,
});
AFAICT, .initialize() is not in the .d.ts file. Maybe add it?
- Dominant language
- JavaScript
- Stars
- 3.7k
- Forks
- 370
- PR merge metrics
- No merged PRs in 30d
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.
More from mozilla/source-map
-
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
mozilla/source-map#530 ·
-
Difficulty 4/5 3-5 days Newbie friendliness 55/100
mozilla/source-map#527 ·
-
Difficulty 4/5 3-5 days Newbie friendliness 45/100
mozilla/source-map#524 · 6 comments ·
-
Difficulty 4/5 3-5 days Newbie friendliness 25/100
mozilla/source-map#516 ·
-
Difficulty 5/5 Over a week Newbie friendliness 30/100
mozilla/source-map#510 · 1 reaction ·
All issues in mozilla/source-map
Similar issues
-
bot:ai-assisted component:compact-js status:untriaged
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
midnightntwrk/midnight-sdk#403 ·
-
Difficulty 1/5 Under an hour Newbie friendliness 92/100
-
Difficulty 1/5 1-3 hours Newbie friendliness 86/100
DavidAnson/markdownlint-cli2#940 ·
-
documentation
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
githubnext/gh-aw-workshop#3692 ·
-
agent/guide documentation hive/hosted-available-lke648397-260827-5n31
Difficulty 2/5 1-3 hours Newbie friendliness 90/100