Create a bundle for browsers that includes the Wasm code?
Open
Nobody has claimed this yet.
feat
- Dominant language
- JavaScript
- Stars
- 3.7k
- Forks
- 370
- PR merge metrics
- No merged PRs in 30d
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?
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 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.
Assessment
- Tech stack
- javascript, wasm, webpack
- Domain
- build-system, tooling
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100