Open
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?